Skip to content

Commit

Permalink
Fixed a bug where the websocket transport was recreating it's transpo…
Browse files Browse the repository at this point in the history
…rt object with every sent message.

(cherry picked from commit adb145b)

Signed-off-by: Pierre <[email protected]>
  • Loading branch information
Emperorlou authored and Pierre committed Jun 15, 2012
1 parent f78c6f4 commit d187b97
Showing 1 changed file with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ public class WebSocketCometTransport extends BaseCometTransport {

private final static Logger logger = Logger.getLogger(WebSocketCometTransport.class.getName());

ServerTransportProtocol transport = null;

@Override
public void connect(int connectionCount) {
disconnect();
Expand All @@ -80,17 +82,23 @@ public void disconnect() {

@Override
protected ServerTransport getServerTransport() {
return new ServerTransportProtocol() {
@Override
void send(String message, AsyncCallback<Void> callback) {
socket.send(message);
callback.onSuccess(null);
}
@Override
String serialize(Object message) throws SerializationException {
return client.getSerializer().serialize(message);
}
};
if (transport==null)
{
transport = new ServerTransportProtocol()
{
@Override
void send(String message, AsyncCallback<Void> callback) {
socket.send(message);
callback.onSuccess(null);
}
@Override
String serialize(Object message) throws SerializationException {
return client.getSerializer().serialize(message);
}
};
}

return transport;
}

public static boolean hasWebSocketSupport() {
Expand Down

4 comments on commit d187b97

@pierreh
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes #424

@jfarcand
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comments: the indentation/format is not following the rest of the code :-)

@pierreh
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed I corrected it on the next commit

@Emperorlou
Copy link
Contributor Author

@Emperorlou Emperorlou commented on d187b97 Jun 16, 2012 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.