在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:kudos/koa-websocket开源软件地址:https://github.com/kudos/koa-websocket开源编程语言:JavaScript 98.9%开源软件介绍:koa-websocket
Supports Installation
UsageSee examples directory for a simple implementation. Let's EncryptExample with Let's Encrypt (the Greenlock package): const Koa = require('koa');
const greenlock = require('greenlock-express');
const websockify = require('koa-websocket');
const le = greenlock.create({
// all your sweet Let's Encrypt options here
});
// the magic happens right here
const app = websockify(new Koa(), wsOptions, le.httpsOptions);
app.ws.use((ctx) => {
// the websocket is added to the context as `ctx.websocket`.
ctx.websocket.on('message', function(message) {
// do something
});
});
app.listen(3000); APIwebsockify(KoaApp, [WebSocketOptions], [httpsOptions])The WebSocket options object just get passed right through to the The optional HTTPS options object gets passed right into LicenseMIT |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论