Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(url) {
this.url = url || 'http://local.mockstarjs.org';
this.socket = io(this.url);
// 序列号,用于识别不同的事件
this._seq = 0;
this.init();
}
_connect() {
this._socket = socketio(this._url);
this._registerSocketMessages(this._socket);
}
constructor() {
this._socket = io('http://localhost:8080');
this._actions = new Actions();
}
this.promiseOfConnection = new Promise((resolve, reject) => {
if (this.connected) return resolve()
if (platform === 'electron') return reject(new Error('Wrong platform.'))
this.socket = io('http://localhost:9753')
this.socket.on('connect', () => {
resolve()
})
this.emit = promisify(this.socket.emit).bind(this.socket)
})
}
public initSocket(room: string): void {
this.socket = socketIo({
path: '/chat',
query: {
room: room,
authToken: this.authenticationService.token
}
});
}