Open marcelrouw opened 3 years ago
Hello @marcelrouw! :wave: we're sorry you found a bug... so first of all, thank you very much for reporting it.
To know about progress, check in Triage. All issues are considered Backlog Candidates until work priorities align and the issue is selected for development. It will then become part of our official Backlog.
Hi, I found a workaround like below. I'm using it now and it works.
(written in TypeScript with Promise-style)
import { EventEmitter } from 'events'
import kurento, { ClientInstance } from 'kurento-client'
const wsUri = "..."
const kurentoClientPromise = kurento(wsUri)
// HACK: A not published API, `kurentoClientPromise._re`, is used here.
// `kurento-client` uses a forked version of `reconnect-ws` to maintain
// the internal WebSocket connection to KMS and sets its instance
// as `_re` property of the promise object returned from `kurento()`.
// See https://github.com/Kurento/kurento-client-js/blob/718c304d32fc70ca649e1a7c6c7f5fbb293d8319/lib/KurentoClient.js#L917-L921 .
// The forked `reconnect-ws` used in `kurento-client` is https://github.com/KurentoForks/reconnect-ws
// and the document says it publishes events described in https://github.com/juliangruber/reconnect-core#usage .
// So, here we set the event listeners for those events to detect reconnection state changes.
const innerReconnect = ((kurentoClientPromise as unknown) as { _re: EventEmitter })._re
innerReconnect.on('connect', (con: WebSocket) => {
// connected
})
innerReconnect.on('reconnect', (n: number, delay: number) => {
// reconnection tried
})
innerReconnect.on('disconnect', (err: Error) => {
// disconnected
})
innerReconnect.on('error', (err: Error) => {
// error occurred
})
let clientInstance: ClientInstance
kurentoClientPromise.then((client: ClientInstance) => {
clientInstance = client
})
I wish these event listeners will be available via public API, without such hacks.
Actually I would like to get rid of all dependencies of KurentoForks, but not sure it it's possible right now. It would be a good change, removing all forks, to make maintenance easier. Because right now, nobody is in charge of maintaining the forks.
We focus more on the Java client because that's what is used by OpenVidu. So the JS client is driven by community contributions. I will review your proposal to see if it can be merged; if you have any other improvement feel free to discuss it in the forum to see if a PR makes sense.
Prerequisites
Issue description
From the events of the kurento client in node, only the
reconnected
works. Thedisconnected
,connectionFailed
andconnected
don't work.Context
This makes it impossible to determine the health of the Kurento server and if we still can setup connection to this server or need to revert to an other kurento server
How to reproduce?
By starting and stopping the kurento server.
Expected & current behavior
We expect to get event on
disconnected
,connectionFailed
andconnected
But we don't get them when starting and stopping of the kurento server(Optional) Possible solution
INFO about Kurento Media Server
INFO about your Application Server
INFO about end-user clients
INFO about your environment
Run these commands