2
0
mirror of https://github.com/tenrok/vue-native-websocket.git synced 2026-06-07 17:22:27 +03:00

Merge pull request #53 from denzow/master

Feature handle skip scheme ws url
This commit is contained in:
Viktor
2018-09-12 15:56:15 +03:00
committed by GitHub
2 changed files with 18 additions and 0 deletions
+4
View File
@@ -3,6 +3,10 @@ import Emitter from './Emitter'
export default class {
constructor (connectionUrl, opts = {}) {
this.format = opts.format && opts.format.toLowerCase()
if(connectionUrl.startsWith('//')){
const scheme = window.location.protocol === 'https:' ? 'wss' : 'ws';
connectionUrl = `${scheme}://${connectionUrl}`
}
this.connectionUrl = connectionUrl
this.opts = opts