Skip to content

Commit

Permalink
Store the handshake as part of the WebsocketChannel.
Browse files Browse the repository at this point in the history
  • Loading branch information
tobias committed Jan 16, 2015
1 parent df7b436 commit 9c6aaf0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
Expand Up @@ -36,7 +36,7 @@ public JavaxWebsocketChannel(final OnOpen onOpen,
}

@Override
public Endpoint getEndpoint() {
public Endpoint endpoint() {
final JavaxWebsocketChannel channel = this;
return new Endpoint() {
@Override
Expand Down
Expand Up @@ -36,7 +36,7 @@ public UndertowWebsocketChannel(final OnOpen onOpen,
}

@Override
public UndertowEndpoint getEndpoint() {
public UndertowEndpoint endpoint() {
final UndertowWebsocketChannel channel = this;
return new UndertowEndpoint() {
@Override
Expand Down
Expand Up @@ -19,7 +19,10 @@
import org.projectodd.wunderboss.web.async.Channel;

public interface WebsocketChannel extends Channel {
Object getEndpoint();
Object endpoint();
Object handshake();

void setHandshake(Object handshake);
void setUnderlyingChannel(Object channel);

interface OnMessage {
Expand Down
Expand Up @@ -26,6 +26,16 @@ public WebsocketChannelSkeleton(final OnOpen onOpen, final OnClose onClose, fina
this.onError = onError;
}

@Override
public Object handshake() {
return this.handshake;
}

@Override
public void setHandshake(Object handshake) {
this.handshake = handshake;
}

@Override
public void notifyOpen(final Object context) {
if (!this.openNotified &&
Expand Down Expand Up @@ -64,6 +74,7 @@ protected void notifyError(Throwable error) {
private final OnClose onClose;
private final OnMessage onMessage;
private final OnError onError;
private Object handshake;
private boolean closeNotified = false;
private boolean openNotified = false;
}

0 comments on commit 9c6aaf0

Please sign in to comment.