无法 ws://localhost:8000/socket/server/startDaemon.php 建立与服务器的连接。var socket = new WebSocket(host);
2022-08-31 01:19:17
我正在使用javascript来连接websocket:
<script>
var socket;
var host = "ws://localhost:8000/socket/server/startDaemon.php";
var socket = new WebSocket(host);
</script>
我得到错误:
无法在
var host = "ws://localhost:8000/socket/server/startDaemon.php";
var socket = new WebSocket(host);
我该如何解决这个问题?
注意:我在 mozilla 中启用了 websocket 以支持 Web 套接字应用程序。当我在chrome中运行时,我得到了错误:
can't establish a connection to the server at ws://localhost:8000/socket/server/startDaemon.php. var socket = new WebSocket(host);