最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(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ó)家法律
鄂州市| 达州市| 大城县| 邵武市| 武清区| 呼图壁县| 河间市| 荥阳市| 砚山县| 榆树市| 虎林市| 聂荣县| 义马市| 新竹市| 虹口区| 望城县| 蒙阴县| 东源县| 湖北省| 皮山县| 临漳县| 哈尔滨市| 梁河县| 大冶市| 四川省| 策勒县| 神农架林区| 出国| 图片| 平湖市| 山阴县| 西乌珠穆沁旗| 苍南县| 洞口县| 通辽市| 昭苏县| 贞丰县| 宁河县| 新竹市| 睢宁县| 灵川县|