1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

WebSocket通信のクライアント/サーバの環境構築

Posted at

#要約
 WebSocket通信のクライアント/サーバの環境を構築する。お仕事でWebSocket通信のツール、環境が必要となった際にまとめたものです。
ezgif.com-gif-maker (10).gif

wsのインストール
~/develop/wscatTest $ yarn init
yarn init v1.22.5
question name (wscatTest): 
question version (1.0.0): 
question description: 
question entry point (index.js): 
question repository url: 
question author: 
question license (MIT): 
question private: 
success Saved package.json
  Done in 2.88s.
~/develop/wscatTest $ yarn add ws
yarn add v1.22.5
info No lockfile found.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...

success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ ws@8.3.0
info All dependencies
└─ ws@8.3.0
  Done in 1.40s.
~/develop/wscatTest $ 
サーバ環境構築
~/develop/wscatTest $ npx wscat -l 3000
Listening on port 3000 (press CTRL+C to quit)
クライアント接続
~/develop/wscatTest $ npx wscat -c ws://localhost:3000
Connected (press CTRL+C to quit)

あとは文字を打てば動画の通りに動きます。Something went wrong

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?