Implement WebSocketServer Adapter (#5866)

* Implement WebSocketServerAdapter

* lint

* clean up
This commit is contained in:
Diamond Lewis
2019-07-30 09:05:41 -05:00
committed by GitHub
parent 7c8e940f53
commit 218c3499f9
10 changed files with 571 additions and 522 deletions

View File

@@ -0,0 +1,22 @@
/*eslint no-unused-vars: "off"*/
import { WSSAdapter } from './WSSAdapter';
const WebSocketServer = require('ws').Server;
/**
* Wrapper for ws node module
*/
export class WSAdapter extends WSSAdapter {
constructor(options: any) {
super(options);
const wss = new WebSocketServer({ server: options.server });
wss.on('listening', this.onListen);
wss.on('connection', this.onConnection);
}
onListen() {}
onConnection(ws) {}
start() {}
close() {}
}
export default WSAdapter;