Add Options to Connection

- Add options which can be passed to connection string for `SocketIO`
This commit is contained in:
eevabec 2019-03-06 09:44:47 -06:00
parent bdcd92a430
commit 0079d7a199

View file

@ -12,10 +12,10 @@ export default class VueSocketIO {
* @param vuex * @param vuex
* @param debug * @param debug
*/ */
constructor({connection, vuex, debug}){ constructor({connection, vuex, debug, options}){
Logger.debug = debug; Logger.debug = debug;
this.io = this.connect(connection); this.io = this.connect(connection, options);
this.emitter = new Emitter(vuex); this.emitter = new Emitter(vuex);
this.listener = new Listener(this.io, this.emitter); this.listener = new Listener(this.io, this.emitter);
@ -39,8 +39,9 @@ export default class VueSocketIO {
/** /**
* registering socketio instance * registering socketio instance
* @param connection * @param connection
* @param options
*/ */
connect(connection){ connect(connection, options){
if(connection && typeof connection === 'object'){ if(connection && typeof connection === 'object'){
@ -52,7 +53,7 @@ export default class VueSocketIO {
Logger.info('Received connection string'); Logger.info('Received connection string');
return this.io = SocketIO(connection); return this.io = SocketIO(connection, options);
} else { } else {