1 | ;
|
2 |
|
3 | // Copyright 2017-2018 Jaco Greeff
|
4 | // This software may be modified and distributed under the terms
|
5 | // of the ISC license. See the LICENSE file for details.
|
6 | const onClose = require('./onClose');
|
7 |
|
8 | const onError = require('./onError');
|
9 |
|
10 | const onMessage = require('./onMessage');
|
11 |
|
12 | const onOpen = require('./onOpen');
|
13 |
|
14 | module.exports = function connect(self) {
|
15 | self.websocket = new WebSocket(self.endpoint);
|
16 | self.websocket.onclose = onClose(self);
|
17 | self.websocket.onerror = onError(self);
|
18 | self.websocket.onmessage = onMessage(self);
|
19 | self.websocket.onopen = onOpen(self);
|
20 | }; |
\ | No newline at end of file |