Commit b1cc1bea authored by Yoann HOUPERT's avatar Yoann HOUPERT

manage socket error on multiplex stream

parent f80dcc06
Pipeline #13948 failed with stage
......@@ -33,18 +33,20 @@
"archive": "http://localhost:8080/api/summary",
"reco": {
"host": "localhost",
"port": 3001,
"port": 3002,
"reconnectInterval": 5000
}
},
"api": 3000,
"proxy": {
"port": 3001,
"port_ws_audio": 3001,
"port_server_proxy": 3002,
"services": {
"reco": {
"host": "hublot_recommender_1",
"host": "83.212.204.91",
"host_docker": "hublot_recommender_1",
"port": 8080,
"reconnectInterval": 50000
"reconnectInterval": 5000
},
"kaldi": "ws://hublot_kaldi-gstreamer_1:80/client/ws/speech?content-type=audio/x-matroska,+rate=(int)48000,+channels=(int)"
}
......
import { EventEmitter } from "events";
class Asd extends EventEmitter{
constructor(controlPort = 8882, streamPort = 8881){
super()
}
async controlConnect(){
return new Promise((resolve, reject)=>{
//... connexion au dibule de Rudy
this.emit('resume_data',data)
})
}
async streamConnect(){
return new Promise((resolve, reject)=>{
})
}
async disconnect(){
}
}
export default new Asd()
\ No newline at end of file
......@@ -24,6 +24,7 @@ const stomp = require('webstomp-client');
const WebSocket = require('ws');
const XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
module.exports = config => {
function createStompClient() {
const stompCapsule = {
......@@ -154,16 +155,22 @@ module.exports = config => {
});
io.sockets.on('connection', (socket) => {
// let asd = {} //port 8881 - connexion de contrôle ASD
console.log("NEW CONNEXION !")
let asd = {} //port 8881 - connexion de contrôle ASD
let userAudioEvents = []
socket.on('error', (err) => {
for (userEvent in userAudioEvents){
socket.removeListener(userEvent)
}
userAudioEvents = []
asd = {} //disconnect and kill asd sockets
})
socket.on('new_user', (userId) => {
//create ASD stream //port 8882 - connexion de data
let vad = userId
userAudioEvents.push('audio_from_' + userId)
//asd.on("resume_data", soket.emit('resume_data'))
//register custom event for user
socket.on('audio_from_' + userId, (data) => {
console.log("DATA RECEIVED FOR USER : ",vad)
console.log("DATA RECEIVED FOR USER : ", asd)
//console.log(data)
//asd.send(data)
})
......@@ -198,3 +205,4 @@ module.exports = config => {
}
};
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment