<!DOCTYPE HTML><HTML><Head> <title>Hello WebSocket</title> <Linkhref= "/webjars/bootstrap/css/bootstrap.min.css"rel= "stylesheet"> <Linkhref= "/main.css"rel= "stylesheet"> <Scriptsrc= "Https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.0.3/socket.io.js"></Script><Script> varSocket=io ('http://wechat.daopeng365.com'); Socket.on ('Connect', function(){}); Socket.emit ('Senddevnum', '6961616647311138'); Socket.on ('messageevent', function(data) {Console.log (data)}); </Script></Head><Body></Body></HTML>
We sometimes encounter the client and server-side listening to each other situation, this time websocket come in handy, Socket.io and websocket the difference on the Internet, I simply understand is Socket.io integrated websocket everything
The difference and understanding between http://blog.csdn.net/while0/article/details/53930116 WebSocket and Socket.io
The following is a simple API that Socket.io is attached to
http://blog.csdn.net/wang8088498/article/details/52194394
The usage of Websocket--socket.io