Merge pull request #3 from ragestudio/dev

Merge 0.62.1
This commit is contained in:
srgooglo 2025-03-28 19:36:05 +01:00 committed by GitHub
commit 4ccaeccf07
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "comty.js", "name": "comty.js",
"version": "0.62.0", "version": "0.62.1",
"main": "./dist/index.js", "main": "./dist/index.js",
"description": "Official Comty API for JavaScript", "description": "Official Comty API for JavaScript",
"homepage": "https://github.com/ragestudio/comty.js", "homepage": "https://github.com/ragestudio/comty.js",

View File

@ -77,7 +77,9 @@ export function createClient({
if (typeof ws === "object") { if (typeof ws === "object") {
if (ws.enable === true) { if (ws.enable === true) {
__comty_shared_state.ws = new WebsocketManager() __comty_shared_state.ws = new WebsocketManager({
origin: origin,
})
if (ws.autoConnect === true) { if (ws.autoConnect === true) {
sharedState.ws.connectAll() sharedState.ws.connectAll()

View File

@ -6,6 +6,10 @@ import { RTEngineClient } from "linebridge-client/src"
//import { RTEngineClient } from "../../linebridge/client/src" //import { RTEngineClient } from "../../linebridge/client/src"
class WebsocketManager { class WebsocketManager {
constructor({ origin }) {
this.origin = origin
}
sockets = new Map() sockets = new Map()
async connect(remote) { async connect(remote) {
@ -23,7 +27,7 @@ class WebsocketManager {
} }
} }
const socket = io(Remotes.origin, opts) const socket = io(this.origin, opts)
socket.on("connect", () => { socket.on("connect", () => {
globalThis.__comty_shared_state.eventBus.emit( globalThis.__comty_shared_state.eventBus.emit(
@ -57,7 +61,7 @@ class WebsocketManager {
const client = new RTEngineClient({ const client = new RTEngineClient({
refName: remote.namespace, refName: remote.namespace,
url: `${Remotes.origin}/${remote.namespace}`, url: `${this.origin}/${remote.namespace}`,
token: Storage.engine.get("token"), token: Storage.engine.get("token"),
}) })