Closed1

GoでWebSocketサーバーを立てたい

あおあお

nodeが入っていれば、wscatをinstallして簡単にwebsocket clientを起動ができる

wscat -c ws://localhost:5160/ws --slash --show-ping-pong

Client

Connected (press CTRL+C to quit)
> /ping
< Received pong
> see you
< received: see you
> /close
Disconnected (code: 1000, reason: "")

Server

go run websocket.go
2022/05/31 20:15:59 Connected
2022/05/31 20:16:07 Connection has been closed.

Code

このスクラップは2022/06/05にクローズされました