如何在JavaScript/HTML中使用套接字?
To use sockets, consider the WebSocket interface in JavaScript. This interface enables web applications to maintain bidirectional communications with server-side processes.
为了使Web应用程序能够与服务器端进程保持双向通信,该规范引入了WebSocket接口。
以下是一些解决Web Sockets的方法:
socket = new WebSocket(url [, protocols ] )
Create a new socket using this, wherein parameters URL is a string for the connection and protocols is a string or array of string.
socket . send( data )
以上用于发送数据。
用于关闭套接字连接。
socket . close( [ code ] [, reason ] )
以下返回用于建立连接的URL。
socket . url
以上就是如何在JavaScript/HTML中使用套接字?的详细内容,更多请关注双恒网络其它相关文章!
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。



