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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user