|
@@ -5,13 +5,13 @@ import * as socketio from 'socket.io-client'
|
5
|
5
|
|
6
|
6
|
export class PromiseIOClient {
|
7
|
7
|
|
8
|
|
- static connect = (port: number, host = "localhost"): Promise<I.Socket> => new Promise((res, rej) => {
|
|
8
|
+ static connect = (port: number, host = "localhost", protocol : 'http:' | 'https:' = "http:"): Promise<I.Socket> => new Promise((res, rej) => {
|
9
|
9
|
try {
|
10
|
|
- const socket = socketio(`http://${host}:${port}`, {
|
|
10
|
+ const socket = socketio(`${protocol}//${host}:${port}`, {
|
11
|
11
|
reconnectionAttempts: 2,
|
12
|
12
|
reconnectionDelay: 200,
|
13
|
13
|
timeout: 450,
|
14
|
|
- reconnection: false
|
|
14
|
+ reconnection: false,
|
15
|
15
|
})
|
16
|
16
|
socket.on('connect_error', e => {
|
17
|
17
|
sock.emit('error', e)
|