@@ -79,7 +79,7 @@ export module VORLON {
7979 } ) ;
8080
8181 app . get ( this . baseURLConfig . baseURL + "/vorlon.max.js/" , ( req : any , res : any ) => {
82- res . redirect ( "/vorlon.max.js/default" ) ;
82+ res . redirect ( this . baseURLConfig . baseURL + "/vorlon.max.js/default" ) ;
8383 } ) ;
8484
8585 app . get ( this . baseURLConfig . baseURL + "/vorlon.max.js/:idsession" , ( req : any , res : any ) => {
@@ -284,8 +284,14 @@ export module VORLON {
284284 javascriptFile += "if (((typeof window != 'undefined' && window.module) || (typeof module != 'undefined')) && typeof module.exports != 'undefined') {\r\n" ;
285285 javascriptFile += "module.exports = VORLON;};\r\n" ;
286286
287+ var startUrl = this . httpConfig . protocol + "://" + req . headers . host ;
288+ if ( baseUrl ) {
289+ var splittedBaseUrl = baseUrl . split ( '//' ) ;
290+ startUrl = splittedBaseUrl [ splittedBaseUrl . length - 1 ] === this . httpConfig . protocol ? baseUrl : startUrl + baseUrl ;
291+ }
292+
287293 if ( autostart ) {
288- javascriptFile += "\r (function() { VORLON.Core.StartClientSide('" + this . httpConfig . protocol + "://" + req . headers . host + "/', '" + req . params . idsession + "'); }());" ;
294+ javascriptFile += "\r (function() { VORLON.Core.StartClientSide('" + startUrl + "/', '" + req . params . idsession + "'); }());" ;
289295 }
290296
291297 res . header ( 'Content-Type' , 'application/javascript' ) ;
@@ -295,18 +301,21 @@ export module VORLON {
295301 }
296302
297303 public start ( httpServer : http . Server ) : void {
304+
298305 //SOCKET.IO
299- var io = socketio ( httpServer ) ;
306+ var io = socketio ( httpServer , { path : this . baseURLConfig . baseURL + "/socket.io" } ) ;
300307 this . _io = io ;
301308
302309 //Listen on /
303- io . on ( "connection" , socket => {
310+ this . _io
311+ . of ( this . baseURLConfig . baseURL + "/client" )
312+ . on ( "connection" , socket => {
304313 this . addClient ( socket ) ;
305314 } ) ;
306315
307316 //Listen on /dashboard
308- var dashboardio = io
309- . of ( "/dashboard" )
317+ this . _io
318+ . of ( this . baseURLConfig . baseURL + "/dashboard" )
310319 . on ( "connection" , socket => {
311320 this . addDashboard ( socket ) ;
312321 } ) ;
@@ -420,7 +429,7 @@ export module VORLON {
420429 this . _sessions . all ( ) . forEach ( ( session ) => {
421430 for ( var clientid in session . connectedClients ) {
422431 var client = session . connectedClients [ clientid ] ;
423- if ( "/ #" + receiveMessage . data . socketid === client . socket . id ) {
432+ if ( this . baseURLConfig . baseURL + "/client #" + receiveMessage . data . socketid === client . socket . id ) {
424433 client . opened = false ;
425434 if ( this . dashboards [ session . sessionId ] ) {
426435 this . _log . debug ( formatLog ( "PLUGIN" , "Send RemoveClient to Dashboard " + socket . id , receiveMessage ) ) ;
0 commit comments