Svelte.js演示-WebSockets



在此視頻中,我們將介紹如何使用REPL將WebSocket與svelte一起使用。

苗條的REPL:
https://svelte.dev/repl/29a5bdfb981f479fb387298aef1190a0?version=3.22.2

Websocket Github:
https://github.com/phptuts/node-relay-server

Ngrok:
https://ngrok.com/

腳步:

git clone https://github.com/phptuts/node-relay-server.git
cd節點中繼伺服器
npm安裝
節點app.js
使用ngrok設置一個帳戶。
npm install -g ngrok
ngrok authtoken「您的身份驗證令牌」
ngrok http 3000
進入message-store.js文件,並將其替換為您的ngrok網址