File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed
Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -10,13 +10,22 @@ if (typeof __resourceQuery === 'string' && __resourceQuery) {
1010 sockOptions = querystring . parse ( __resourceQuery . substr ( 1 ) )
1111}
1212
13- const connection = new SockJS (
14- `${ window . location . protocol } //${
15- sockOptions . sockHost || window . location . hostname
16- } :${ sockOptions . sockPort || window . location . port } ${
17- sockOptions . sockPath || '/sockjs-node'
18- } `,
19- )
13+ const connection =
14+ sockOptions . sockPath === '/ws' && typeof WebSocket !== 'undefined'
15+ ? new WebSocket (
16+ `${ window . location . protocol === 'https:' ? 'wss:' : 'ws:' } //${
17+ sockOptions . sockHost || window . location . hostname
18+ } :${ sockOptions . sockPort || window . location . port } ${
19+ sockOptions . sockPath || '/ws'
20+ } `,
21+ )
22+ : new SockJS (
23+ `${ window . location . protocol } //${
24+ sockOptions . sockHost || window . location . hostname
25+ } :${ sockOptions . sockPort || window . location . port } ${
26+ sockOptions . sockPath || '/sockjs-node'
27+ } `,
28+ )
2029
2130connection . onmessage = function onmessage ( e ) {
2231 const { type, data } = JSON . parse ( e . data )
You can’t perform that action at this time.
0 commit comments