1 | const SockJS = require('sockjs-client/dist/sockjs');
|
2 | const safeThis = require('./utils/safeThis');
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | function SockJSClient(url) {
|
10 | this.socket = new SockJS(url);
|
11 | }
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | SockJSClient.prototype.onClose = function onClose(fn) {
|
18 | this.socket.onclose = fn;
|
19 | };
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 | SockJSClient.prototype.onMessage = function onMessage(fn) {
|
26 | this.socket.onmessage = function onMessageHandler(event) {
|
27 | fn(event.data);
|
28 | };
|
29 | };
|
30 |
|
31 | safeThis.__webpack_dev_server_client__ = SockJSClient;
|