Skip to content
This repository has been archived by the owner on Nov 18, 2018. It is now read-only.

Fixing SockJS session handling for xhr/jsonp polling. #72

Merged
merged 1 commit into from Mar 12, 2014
Merged

Fixing SockJS session handling for xhr/jsonp polling. #72

merged 1 commit into from Mar 12, 2014

Conversation

danbev
Copy link
Contributor

@danbev danbev commented Mar 12, 2014

The is a re-opening of AGSMPLPUSH-42 which intended to fix this issue
but the fix was just plain wrong.

The original issue was that the polling transports did to reply with any
data when messages had been sent to them. The fix then was to add an
explicit empty reply to trigger SockJS to repoll and it was then able
to retrieve data.
But the polling transports are "long polling" in that they will remain
until either data is made available by the server side or the session
times out.

This commit fixes the session handling by introducing a field in the
SockJSSession class which is the ChannelHandlerContext used for an
open connection. This 'openContext' is then available to be used
by SessionState implementations, for example the PollingSessionState.
PollingSessionState sometimes needs to use the ChannelHandlerContext
used to connect which is needed to send the SockJS OpenFrame, but
successive calls needs to use the ChannelHandlerContext for the
open session.

Additional changes:

  • SockJS test server can now be started with mvn exec:java
  • sockjs-client.html contains examples of specifying transports types

[https://issues.jboss.org/browse/AGSMPLPUSH-42]

The is a re-opening of AGSMPLPUSH-42 which intended to fix this issue
but the fix was just plain wrong.

The original issue was that the polling transports did to reply with any
data when messages had been sent to them. The fix then was to add an
explicit empty reply to trigger SockJS to repoll and it was then able
to retrieve data.
But the polling transports are "long polling" in that they will remain
until either data is made available by the server side or the session
times out.

This commit fixes the session handling by introducing a field in the
SockJSSession class which is the ChannelHandlerContext used for an
open connection. This 'openContext' is then available to be used
by SessionState implementations, for example the PollingSessionState.
PollingSessionState sometimes needs to use the ChannelHandlerContext
used to connect which is needed to send the SockJS OpenFrame, but
successive calls needs to use the ChannelHandlerContext for the
open session.

Additional changes:
- SockJS test server can now be started with mvn exec:java
- sockjs-client.html contains examples of specifying transports types

[https://issues.jboss.org/browse/AGSMPLPUSH-42]
@danbev
Copy link
Contributor Author

danbev commented Mar 12, 2014

An instance containing this PR's code can be found here:
https://newsps-dbevenius.rhcloud.com:8443/simplepush

@matzew
Copy link
Contributor

matzew commented Mar 12, 2014

looks good and test works:

http://people.apache.org/~matzew/sockjs-client.html

👍

@matzew matzew merged commit 6b9bf8c into aerogear-attic:master Mar 12, 2014
@matzew
Copy link
Contributor

matzew commented Mar 12, 2014

thanks, landed!

@danbev danbev deleted the AGSMPLPUSH-42-session-fix branch March 12, 2014 14:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants