Update.
This commit is contained in:
parent
4ae846cf8b
commit
fb7cb35921
@ -208,9 +208,11 @@ class Socket extends EventHandler {
|
|||||||
ws = null
|
ws = null
|
||||||
isConnected = null
|
isConnected = null
|
||||||
isConnecting = null
|
isConnecting = null
|
||||||
|
url = null
|
||||||
connectPromises = []
|
connectPromises = []
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
|
this.url = window.location.hostname == 'localhost' ? 'ws://localhost/rpc.ws' : 'wss://' + window.location.hostname +'/rpc.ws'
|
||||||
this.ensureConnection()
|
this.ensureConnection()
|
||||||
}
|
}
|
||||||
_camelToSnake(str) {
|
_camelToSnake(str) {
|
||||||
@ -254,7 +256,8 @@ class Socket extends EventHandler {
|
|||||||
}
|
}
|
||||||
return new Promise((resolve,reject)=>{
|
return new Promise((resolve,reject)=>{
|
||||||
me.connectPromises.push(resolve)
|
me.connectPromises.push(resolve)
|
||||||
const ws = new WebSocket("ws://localhost:8081/rpc.ws")
|
|
||||||
|
const ws = new WebSocket(this.url)
|
||||||
ws.onopen = (event) => {
|
ws.onopen = (event) => {
|
||||||
me.ws = ws
|
me.ws = ws
|
||||||
me.isConnected = true
|
me.isConnected = true
|
||||||
|
Loading…
Reference in New Issue
Block a user