Socket.io built the websocket, but I couldn’t connect it with native js?

  node.js, question

index.js

/**
 * Created by mh on 2016/9/15.
 */
 var path = require('path');
 var express = require('express');
 var app = express();
 var http = require('http').Server(app);
 var io = require('socket.io')(http);
 
 app.use(express.static('public'));
 
 app.get('/', function(req, res){
 Res.sendFile(__dirname plus' /index.html');
 });
 
 
 
 io.on('connection', function(socket){
 console.log('a user connected');
 socket.on('chat message', function(msg){
 socket.broadcast.emit('chat message' ,msg);
 });
 });
 
 http.listen(3000, function() {
 console.log('listening on *:3000');
 });

Results:

clipboard.png

This is the connection code:

clipboard.png

Should use socket.io matching front-end library connection