Bonjour,

Je suis en train de monter un serveur WebSocket sous nodejs pour faire communiquer en peer to peer deux RTCPeerConnection ( Video streaming). Mon problème est le suivant, je n'arrive jamais à catcher l'event message pour envoyer mes données à un des clients. Ci-joint mon code :

const WebsocketServer = require('ws').Server;aroundconst WebSocket = require('ws')aroundconst fs = require('fs');aroundconst https = require('https');around aroundconst server = https.createServer({around cert: fs.readFileSync('Mes certif'),around key: fs.readFileSync('Mes certifs')around});around aroundserver.listen(8090);around aroundconst wss = new WebsocketServer({server});aroundWebSocket.createWebSocketStream(wss)aroundwss.on('connection', function connection(ws) {around console.log("Client connecté...");around ws.on('open',() => {around wss.clients.forEach(function each(client) {around if (client.readyState === WebSocket.OPEN) {around console.warn('open')around client.send('{data:"Hello"}');around }around });around })around ws.on('message', function incoming(data){around console.warn(data)around wss.clients.forEach(function each(client) {around if (client.readyState === WebSocket.OPEN) {around client.send(data);around }around });around });around ws.on('close', () => console.log('Client déconnecté ...'));around});

Du côté client j'appel mon websocket de cette manière
Code : Sélectionner tout - Visualiser dans une fenêtre à part

let socket = new WebSocket("wss://monwebsocket:8090");aroundque j'envoi dans mon objet RTCPeerConnection

Merci d'avance pour votre aide,
Cordialement

Aucune réponse