versatica / protoo Goto Github PK
View Code? Open in Web Editor NEWMinimalist and extensible Node.js signaling framework for multi-party Real-Time applications
Home Page: https://protoo.versatica.com
License: MIT License
Minimalist and extensible Node.js signaling framework for multi-party Real-Time applications
Home Page: https://protoo.versatica.com
License: MIT License
Appreciate everything the group has done.
It seems like this project is evolving into a nice alternative to socket.io for a websocket transport.
I'm not sure what the roadmap looks like in regards to adding other sorts of servers/transports (similar to SocksJS), but if there's any way to add this into this library, it would be useful.
Having something like:
const protooXhrPollingServer = new protoo.XhrPollingServer(httpServer, options);
would be awesome.. Thanks for your time!
I've put some authorization logic inside protoo server. When auth fails, client still tries to connect again, which isn't what I want.
At the same time, once client gets connected and connection is lost, I want it to try to reconnect.
Hi guys,
At the moment protoo-client always auto retries WS connections due to wasConnected
check here.
The only way around this is to try to set _closed
true here.
Would you guys willing to accepts PRs to disable the usage of node-retry when creating WebSocketTransport?
The main reason is that for code maintenance, using event callback events can become hard to maintain. An example is when a mediasoup transport fails when connecting to a VPN during a call and the WS keeps the connection alive.
Tks.
Thanks for this delightful lib! It was a breeze to set up and I'm looking forward to using it in everything.
I noticed a couple of small errors in the example code on https://protoojs.org:
The websocketserver example says
const server = new protooServer.WebSocketServer.Room(httpServer, options);
but there is no Room
method; protooServer.WebSocketServer
is the constructor.
The connectionrequest example should say await
instead of async
.
I am trying to send a Map as a part of an object from protoo request from frontend, to the backend where protoo request is being handled, but on logging the data on backend, the map being received inside the object is empty.
Other fields come fine, which are String and int types.
Hi,
I've question.
is Protoo library
a real peer to peer server and client?
Can use part of enterprise application?
Can connect to protoo server from C#, Delphi, Java or etc...?
Thank you.
In websites it's so common to have a chat widget and the user to be able to detach it into a separate browser window. That operation involves a fast WS disconnection followed by a new connection with same data.
Protoo server should let time span for such a fast-reconnection without emitting both "offline" and "online". It should be a new setting into the Application
.
My package.json file:
"protoo-client": "^3.0.0"
Browse will report error: "Uncaught TypeError: _this2.listenerCount is not a function"
bellow code report error:
if (_this2.listenerCount('message') === 0) {
logger.error('no listeners for WebSocket "message" event, ignoring received message');
return;
}
For some security projects, I hope to support the communication encryption function。Of course, this is just a suggestion
I just started trying protoo and got random disconnect/reconnect (close/open) events fired on the client peer (same on the server side peer). Just trying to figure out if it's something I'm missing out or it's just a bug.
My client side app strongly relies on the peer "open" event, which as i said, fires multiple times because of the random "reconnection" behaviour.
If you don't know what im talking about I'll provide you with the code I'm using.
This is my console atm.
Have I missed some configuration?
Thank you very much for your work.
I was using this https://github.com/meething/meething-mediasoup project on a Debian 9 and it was working fine, but since I upgraded Debian 11 there is a crash which happens almost every 10h or 20h
This crash is quite painful, it is for a production server
Here is the error :
_createConsumer() | failed:Error: TypeError: Cannot read properties of null (reading 'consume')
at Peer._handleResponse (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/Peer.js:282:18)
at WebSocketTransport.<anonymous> (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/Peer.js:214:10)
at WebSocketTransport.emit (node:events:390:28)
at WebSocketTransport.safeEmit (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/EnhancedEventEmitter.js:18:9)
at WebSocketConnection.<anonymous> (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/transports/WebSocketTransport.js:129:9)
at WebSocketConnection.emit (node:events:390:28)
at WebSocketConnection.processFrame (/home/debian/node/mediasoup/meething-mediasoup/node_modules/websocket/lib/WebSocketConnection.js:554:26)
at /home/debian/node/mediasoup/meething-mediasoup/node_modules/websocket/lib/WebSocketConnection.js:323:40
at processTicksAndRejections (node:internal/process/task_queues:78:11) {
[stack]: "Error: TypeError: Cannot read properties of null (reading 'consume')\n" +
' at Peer._handleResponse (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/Peer.js:282:18)\n' +
' at WebSocketTransport.<anonymous> (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/Peer.js:214:10)\n' +
' at WebSocketTransport.emit (node:events:390:28)\n' +
' at WebSocketTransport.safeEmit (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/EnhancedEventEmitter.js:18:9)\n' +
' at WebSocketConnection.<anonymous> (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/transports/WebSocketTransport.js:129:9)\n' +
' at WebSocketConnection.emit (node:events:390:28)\n' +
' at WebSocketConnection.processFrame (/home/debian/node/mediasoup/meething-mediasoup/node_modules/websocket/lib/WebSocketConnection.js:554:26)\n' +
' at /home/debian/node/mediasoup/meething-mediasoup/node_modules/websocket/lib/WebSocketConnection.js:323:40\n' +
' at processTicksAndRejections (node:internal/process/task_queues:78:11)',
[message]: "TypeError: Cannot read properties of null (reading 'consume')",
code: 500
}
_createConsumer() | failed:Error: request timeout
at Timeout._onTimeout (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/Peer.js:156:14)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7) {
[stack]: 'Error: request timeout\n' +
' at Timeout._onTimeout (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/Peer.js:156:14)\n' +
' at listOnTimeout (node:internal/timers:557:17)\n' +
' at processTimers (node:internal/timers:500:7)',
[message]: 'request timeout'
}
request failed:Error: producer with id "e509edbb-5687-4003-94fe-b71eb325edaf" not found
at ConfRoom._handleProtooRequest (/home/debian/node/mediasoup/meething-mediasoup/lib/Room.js:222:17)
at Peer.<anonymous> (/home/debian/node/mediasoup/meething-mediasoup/lib/Room.js:58:12)
at Peer.emit (node:events:390:28)
at Peer._handleRequest (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/Peer.js:224:9)
at WebSocketTransport.<anonymous> (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/Peer.js:212:10)
at WebSocketTransport.emit (node:events:390:28)
at WebSocketTransport.safeEmit (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/EnhancedEventEmitter.js:18:9)
at WebSocketConnection.<anonymous> (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/transports/WebSocketTransport.js:129:9)
at WebSocketConnection.emit (node:events:390:28)
at WebSocketConnection.processFrame (/home/debian/node/mediasoup/meething-mediasoup/node_modules/websocket/lib/WebSocketConnection.js:554:26) {
[stack]: 'Error: producer with id "e509edbb-5687-4003-94fe-b71eb325edaf" not found\n' +
' at ConfRoom._handleProtooRequest (/home/debian/node/mediasoup/meething-mediasoup/lib/Room.js:222:17)\n' +
' at Peer.<anonymous> (/home/debian/node/mediasoup/meething-mediasoup/lib/Room.js:58:12)\n' +
' at Peer.emit (node:events:390:28)\n' +
' at Peer._handleRequest (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/Peer.js:224:9)\n' +
' at WebSocketTransport.<anonymous> (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/Peer.js:212:10)\n' +
' at WebSocketTransport.emit (node:events:390:28)\n' +
' at WebSocketTransport.safeEmit (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/EnhancedEventEmitter.js:18:9)\n' +
' at WebSocketConnection.<anonymous> (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/transports/WebSocketTransport.js:129:9)\n' +
' at WebSocketConnection.emit (node:events:390:28)\n' +
' at WebSocketConnection.processFrame (/home/debian/node/mediasoup/meething-mediasoup/node_modules/websocket/lib/WebSocketConnection.js:554:26)',
[message]: 'producer with id "e509edbb-5687-4003-94fe-b71eb325edaf" not found'
}
/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/Peer.js:156
pReject(new Error('request timeout'));
^
Error: request timeout
at Timeout._onTimeout (/home/debian/node/mediasoup/meething-mediasoup/node_modules/protoo-server/lib/Peer.js:156:14)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7)
Is this a problem with protoo-server or mediasoup or meething-mediasoup?
package.json :
{
"name": "meething-mediasoup",
"version": "1.0.2",
"description": "",
"scripts": {
"start": "nodemon ./main.js ./lib"
},
"dependencies": {
"mediasoup": "^3.7.9",
"protoo-server": "^4.0.6",
"quick-lru": "^5.1.0",
"stun": "^2.1.0"
},
"devDependencies": {
"nodemon": "^1.19.1"
}
}
For example, the future Room
class creates a Route
via let route = app.Route()
, so when the room is closed it must be removed.
Not easy, but there are some hacks for Express doing the same:
I killed my android app, but the server didn't trigger close。Is this a bug in my code or is it not affected by the heartbeat mechanism?
I am using this server-side in nodejs project and trying to connect from iOS client using Starscream but receiving protoo-server:WARN:WebSocketServer _onRequest() | invalid/missing Sec-WebSocket-Protocol
.
I just want to confirm that there is no limitation where I can't connect from non-protoo client.
It's hard to repeat the bug, but it sometimes happens. It happen one time in 2 days nearly.
2024-02-28T03:46:13.286Z protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[114.254.0.69]:53390, error:Error: read ECONNRESET
at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20) {
errno: -104,
code: 'ECONNRESET',
syscall: 'read'
}]
node:events:497
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20)
Emitted 'error' event on TLSSocket instance at:
at emitErrorNT (node:internal/streams/destroy:169:8)
at emitErrorCloseNT (node:internal/streams/destroy:128:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -104,
code: 'ECONNRESET',
syscall: 'read'
}
after the log above show, the node crash. It seems one exception is not handled by try...catch.
node version:
node --version
v21.5.0
Options such as keepalive
, keepaliveInterval
, etc (those provided by the WebSocketServer).
Right now looking at the documentation and code it is unclear how to use multiple rooms. There is also no way to distinguish them in the Room object (no id or name).
Something such as:
app.addMethod(method);
This just happened, producing an infinite loop (kill -9
required):
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +1ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +1ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +21ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +1ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +1ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
protoo-server:ERROR:WebSocketTransport connection "error" event [conn:WSS:[192.168.1.33]:55930, error:Error: This socket has been ended by the other party] +0ms
Allow calling reject(error)
being error
an instance of Error
. In that case, do this:
reject(503, error.toString());
Are there plans to support typescript?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.