Skip to content

Commit

Permalink
feat(WebChannel): make possible to specify a key for WebChannel.open
Browse files Browse the repository at this point in the history
  • Loading branch information
kalitine committed Jul 27, 2016
1 parent 79ee106 commit ac6d13b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
8 changes: 5 additions & 3 deletions dist/netflux.es2015.js
Original file line number Diff line number Diff line change
Expand Up @@ -2707,11 +2707,13 @@ class WebChannelGate {
* @param {WebChannelGate~AccessData} accessData - Access data to join the
* *WebChannel
*/
open (onChannel, url) {
open (onChannel, options) {
let url = options.signaling

return new Promise((resolve, reject) => {
let webRTCService = provide(WEBRTC)
let webSocketService = provide(WEBSOCKET)
let key = this.generateKey()
let key = 'key' in options ? options.key : this.generateKey()
webSocketService.connect(url)
.then((ws) => {
ws.onclose = (closeEvt) => {
Expand Down Expand Up @@ -3013,7 +3015,7 @@ class WebChannel {
return this.gate.open((channel) => {
this.initChannel(channel)
.then((channel) => this.addChannel(channel))
}, settings.signaling)
}, settings)
}

/**
Expand Down
8 changes: 5 additions & 3 deletions dist/netflux.es2015.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -2713,11 +2713,13 @@
* @param {WebChannelGate~AccessData} accessData - Access data to join the
* *WebChannel
*/
open (onChannel, url) {
open (onChannel, options) {
let url = options.signaling

return new Promise((resolve, reject) => {
let webRTCService = provide(WEBRTC)
let webSocketService = provide(WEBSOCKET)
let key = this.generateKey()
let key = 'key' in options ? options.key : this.generateKey()
webSocketService.connect(url)
.then((ws) => {
ws.onclose = (closeEvt) => {
Expand Down Expand Up @@ -3019,7 +3021,7 @@
return this.gate.open((channel) => {
this.initChannel(channel)
.then((channel) => this.addChannel(channel))
}, settings.signaling)
}, settings)
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/WebChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ class WebChannel {
return this.gate.open((channel) => {
this.initChannel(channel)
.then((channel) => this.addChannel(channel))
}, settings.signaling)
}, settings)
}

/**
Expand Down
6 changes: 4 additions & 2 deletions src/WebChannelGate.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ class WebChannelGate {
* @param {WebChannelGate~AccessData} accessData - Access data to join the
* *WebChannel
*/
open (onChannel, url) {
open (onChannel, options) {
let url = options.signaling

return new Promise((resolve, reject) => {
let webRTCService = provide(WEBRTC)
let webSocketService = provide(WEBSOCKET)
let key = this.generateKey()
let key = 'key' in options ? options.key : this.generateKey()
webSocketService.connect(url)
.then((ws) => {
ws.onclose = (closeEvt) => {
Expand Down

0 comments on commit ac6d13b

Please sign in to comment.