Home  >  Q&A  >  body text

javascript - Unsuccessful connection to websocket using socket.io

websocket address:

ws://118.190.23.192:8081/websocket/weionwall/e26d78da-68d8-475d-8f41-d2bd1c5d4aff/false

If it is new WebSocket('address'), it will succeed.

It’s strange that the connection fails using socket.io JS.

var socket = io.connect('ws://118.190.23.192:8081/websocket/weionwall/e26d78da-68d8-475d-8f41-d2bd1c5d4aff/false')

socket.on('connect', data => {
    console.log(data);
})

This is the cdn I use

<script src="//cdn.bootcss.com/socket.io/2.0.3/socket.io.js"></script>

Why are you guys wrong? ?

三叔三叔2672 days ago1196

reply all(1)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-06-28 09:29:43

    Cross-domain, right? No 'Access-Control-Allow-Origin' header
    Increasing cross-domain support in the http service is actually adding Access-Control-Allow-Origin in the http header

    reply
    0
  • Cancelreply