websocket
microcosm1994
这个作者很懒,什么都没留下…
展开
-
vue使用websocket创建连接与重连
我自己把websocket封装成一个模块,包括创建连接、发送消息、重连等,里边也封装了一些我自己项目需要的一些功能 Import import ws from '@/assets/lib/ws' Vue.prototype.$ws = ws Use // 创建websocket连接 this.$ws.init(self.$Socket_url, this.ruleForm, functi...原创 2018-11-27 10:56:14 · 7281 阅读 · 0 评论 -
egg使用egg-socket.io
下载 npm i egg-socket.io --save 使用 plugin.js module.exports.io = { enable: true, package: 'egg-socket.io', } // config.default.js config.io = { init: { }, // passed to engine.io ...原创 2019-06-25 11:53:12 · 7361 阅读 · 3 评论 -
react使用socket-client
下载 nom i socket.io-client --save 使用 import io from 'socket.io-client' // 创建socket连接,http使用ws协议,https使用wss协议 const socket = io('wss://www.dubo.world', { reconnectionAttempts: 10, query: ...原创 2019-06-25 12:03:25 · 5083 阅读 · 0 评论