在 vue中使用 websocket

版权声明:转发请标明出处 https://blog.csdn.net/hailangtuteng/article/details/82668066

在methods 里面初始化websocket 

在created里面进行调用

websocketopen() {websocket连接成功后的触的函数}

websocketonmessage(e){ 数据接收后触发的函数}

e为后台推送过来的数据

websocketclose(){ 关闭后触发的函数}

websocketerror(){连接失败后触发的函数}

猜你喜欢

转载自blog.csdn.net/hailangtuteng/article/details/82668066