无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

云州泇滴Go+Vue通用后臺(tái)管理項(xiàng)目實(shí)戰(zhàn)

2023-08-22 14:17 作者:bili_67158895267  | 我要投稿

創(chuàng)建WebSocket服務(wù)端程序

1、創(chuàng)建目錄chat并初始化

cd chat go mod init chat

2、增加文件client.go,該文件處理WebSocket客戶端程序。其中serveWebsocket()函數(shù)處理客戶端連接。

package mainimport ( ? ?"bytes" ? ?"log" ? ?"net/http" ? ?"time" ? ?"github.com/gorilla/websocket")const ( ? ?// Time allowed to write a message to the peer. ? ?writeWait = 10 * time.Second ? ?// Time allowed to read the next pong message from the peer. ? ?pongWait = 60 * time.Second ? ?// Send pings to peer with this period. Must be less than pongWait. ? ?pingPeriod = (pongWait * 9) / 10 ? ?// Maximum message size allowed from peer. ? ?maxMessageSize = 512)var ( ? ?newline = []byte{'\n'} ? ?space ? = []byte{' '})



云州泇滴Go+Vue通用后臺(tái)管理項(xiàng)目實(shí)戰(zhàn)的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
老河口市| 澄江县| 通辽市| 深泽县| 太和县| 曲麻莱县| 旬邑县| 河西区| 石家庄市| 南溪县| 建始县| 含山县| 巧家县| 扶风县| 福建省| 肇庆市| 锡林浩特市| 兴国县| 疏勒县| 葵青区| 章丘市| 五峰| 彰武县| 侯马市| 阿尔山市| 娄烦县| 银川市| 天峨县| 青州市| 灯塔市| 柘城县| 盘山县| 新昌县| 大埔区| 廊坊市| 调兵山市| 资溪县| 宜兰县| 崇仁县| 张掖市| 浦城县|