@@ -17,7 +17,7 @@ exports.subscribeToChanges_SSE = function(req, res) {
1717
1818 var messageCount ;
1919 debug ( "Server Side Events subscription" ) ;
20- var targetPath = req . path . slice ( 0 , - options . suffixChanges . length ) ; // lop off ',events'
20+ var targetPath = req . originalUrl . slice ( 0 , - options . suffixChanges . length ) ; // lop off ',events'
2121 if ( SSEsubscriptions [ targetPath ] === undefined ) {
2222 SSEsubscriptions [ targetPath ] = redis . createClient ( ) ;
2323 }
@@ -61,7 +61,7 @@ exports.subscribeToChanges_SSE = function(req, res) {
6161exports . publishDelta_SSE = function ( req , res , patchKB , targetURI ) {
6262 // @@ TODO
6363 var options = req . app . locals . ldp ;
64- var targetPath = req . path . slice ( 0 , - options . suffixChanges . length ) ; // lop off ',changes'
64+ var targetPath = req . originalUrl . slice ( 0 , - options . suffixChanges . length ) ; // lop off ',changes'
6565 var publisherClient = SSEsubscriptions [ targetPath ] ;
6666 publisherClient . publish ( 'updates' , ( '"' + targetPath + '" data changed visited' ) ) ;
6767} ;
@@ -74,7 +74,7 @@ var DelayedResponse = require('http-delayed-response');
7474
7575exports . subscribeToChangesLongPoll = function ( req , res ) {
7676 var options = req . app . locals . ldp ;
77- var targetPath = req . path . slice ( 0 , - options . suffixChanges . length ) ; // lop off ',changes'
77+ var targetPath = req . originalUrl . slice ( 0 , - options . suffixChanges . length ) ; // lop off ',changes'
7878 if ( subscriptions [ targetPath ] === undefined ) {
7979 subscriptions [ targetPath ] = [ ] ;
8080 }
@@ -144,7 +144,7 @@ exports.publishDelta = function (req, res, patchKB, targetURI){
144144 patchKB . add ( operation , PATCH ( 'logged' ) , new Date ( ) ) ; // @@ also add user
145145 var patchData = $rdf . serialize ( undefined , patchKB , targetURI , 'text/n3' ) ;
146146
147- debug ( "Distributing change to " + req . path + ", patch is: " ) ;
147+ debug ( "Distributing change to " + req . originalUrl + ", patch is: " ) ;
148148 debug ( "[[[" + patchData + "]]]\n" ) ;
149149
150150 this . publishDelta_LongPoll ( req , res , patchData , targetURI ) ;
@@ -153,10 +153,10 @@ exports.publishDelta = function (req, res, patchKB, targetURI){
153153
154154exports . publishDelta_LongPoll = function ( req , res , patchData , targetURI ) {
155155 var options = req . app . locals . ldp ;
156- debug ( " Long poll change subscription count " + ( subscriptions [ req . path ] || [ ] ) . length ) ;
157- if ( ! subscriptions [ req . path ] ) return ;
158- subscriptions [ req . path ] . map ( function ( subscription ) {
159- debug ( " Long poll change to " + req . path ) ;
156+ debug ( " Long poll change subscription count " + ( subscriptions [ req . originalUrl ] || [ ] ) . length ) ;
157+ if ( ! subscriptions [ req . originalUrl ] ) return ;
158+ subscriptions [ req . originalUrl ] . map ( function ( subscription ) {
159+ debug ( " Long poll change to " + req . originalUrl ) ;
160160 if ( options . leavePatchConnectionOpen ) {
161161 subscription . response . write ( patchData ) ;
162162 } else {
@@ -166,6 +166,6 @@ exports.publishDelta_LongPoll = function (req, res, patchData, targetURI){
166166 }
167167 } ) ;
168168
169- subscriptions [ req . path ] = [ ] ; // one-off polll
169+ subscriptions [ req . originalUrl ] = [ ] ; // one-off polll
170170 debug ( "LONG POLL : Now NO subscriptions for " + targetURI ) ;
171171} ;
0 commit comments