mirror of
https://github.com/ragestudio/comty.js.git
synced 2025-06-09 02:24:18 +00:00
commit
4ccaeccf07
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "comty.js",
|
||||
"version": "0.62.0",
|
||||
"version": "0.62.1",
|
||||
"main": "./dist/index.js",
|
||||
"description": "Official Comty API for JavaScript",
|
||||
"homepage": "https://github.com/ragestudio/comty.js",
|
||||
|
@ -77,7 +77,9 @@ export function createClient({
|
||||
|
||||
if (typeof ws === "object") {
|
||||
if (ws.enable === true) {
|
||||
__comty_shared_state.ws = new WebsocketManager()
|
||||
__comty_shared_state.ws = new WebsocketManager({
|
||||
origin: origin,
|
||||
})
|
||||
|
||||
if (ws.autoConnect === true) {
|
||||
sharedState.ws.connectAll()
|
||||
|
@ -6,6 +6,10 @@ import { RTEngineClient } from "linebridge-client/src"
|
||||
//import { RTEngineClient } from "../../linebridge/client/src"
|
||||
|
||||
class WebsocketManager {
|
||||
constructor({ origin }) {
|
||||
this.origin = origin
|
||||
}
|
||||
|
||||
sockets = new Map()
|
||||
|
||||
async connect(remote) {
|
||||
@ -23,7 +27,7 @@ class WebsocketManager {
|
||||
}
|
||||
}
|
||||
|
||||
const socket = io(Remotes.origin, opts)
|
||||
const socket = io(this.origin, opts)
|
||||
|
||||
socket.on("connect", () => {
|
||||
globalThis.__comty_shared_state.eventBus.emit(
|
||||
@ -57,7 +61,7 @@ class WebsocketManager {
|
||||
|
||||
const client = new RTEngineClient({
|
||||
refName: remote.namespace,
|
||||
url: `${Remotes.origin}/${remote.namespace}`,
|
||||
url: `${this.origin}/${remote.namespace}`,
|
||||
token: Storage.engine.get("token"),
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user