Skip to content

Commit 8382925

Browse files
committed
chore: new socket
1 parent ea44051 commit 8382925

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

src/index.js

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const ConnectedWidget = forwardRef((props, ref) => {
3333
isInitialized() {
3434
console.log('is it init', this.socket !== null && this.socket.connected);
3535
console.log('marker', this.marker);
36-
console.log('socket',this.socket);
36+
console.log('socket', this.socket);
3737
return this.socket !== null;
3838
}
3939

@@ -53,25 +53,24 @@ const ConnectedWidget = forwardRef((props, ref) => {
5353

5454
close() {
5555
if (this.socket) {
56-
console.log('closed')
56+
console.log('closed');
5757
this.socket.close();
5858
}
5959
}
6060

6161
createSocket() {
62-
console.log('trying to create socket')
63-
if (this.socket === null) {
64-
console.log('new socket')
65-
this.socket = socket(
66-
this.url,
67-
this.customData,
68-
this.path,
69-
this.protocol,
70-
this.protocolOptions
71-
);
72-
}
73-
console.log('already exist')
74-
62+
console.log('trying to create socket');
63+
// if (this.socket === null) {
64+
console.log('new socket');
65+
this.socket = socket(
66+
this.url,
67+
this.customData,
68+
this.path,
69+
this.protocol,
70+
this.protocolOptions
71+
);
72+
// console.log('already exist')
73+
7574
this.onEvents.forEach((event) => {
7675
this.socket.on(event.event, event.callback);
7776
});
@@ -80,8 +79,8 @@ const ConnectedWidget = forwardRef((props, ref) => {
8079
Object.keys(this.onSocketEvent).forEach((event) => {
8180
this.socket.on(event, this.onSocketEvent[event]);
8281
});
82+
}
8383
}
84-
}
8584

8685
const sock = new Socket(
8786
props.socketUrl,

0 commit comments

Comments
 (0)