wsmock-js
在没有服务器的浏览器中模拟WebSocket。
入门
安装
纱:
yarn add wsmock-js --dev
使用[removed]标签:
[removed][removed]
定义模拟设置
import wsm from 'wsmock-js'
wsm . mock ( {
url : 'ws://some.mock.url' ,
sendInterval : 'onreceive' ,
receiver ( data ) { // 'data' is sent by webSocket.send in browser
console . log ( data )
} ,
sender ( ) { // Simulating server send
this . response
1