Skip to content

Commit

Permalink
Remove undecided sendMessage code
Browse files Browse the repository at this point in the history
  • Loading branch information
ia3andy committed Sep 28, 2021
1 parent 2d55d09 commit d0e83ce
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,7 @@ public void onError(Session session, @PathParam("name") String name, Throwable t
}

@OnMessage
public void onMessage(String message, @PathParam("username") String name) {
public void onMessage(String message, @PathParam("name") String name) {
System.out.println("onMessage> " + name + ": " + message);
}

/**
* Send a message to a remote websocket session
*
* @param session the websocket session
* @param message the message to send
* @throws IOException if there is a communication error sending the message object.
* @throws EncodeException if there was a problem encoding the message.
* @throws IllegalArgumentException if the message parameter is {@code null}
*/
public void sendMessage(Session session, String message) throws EncodeException, IOException {
requireNonNull(session, "session is required");

session.getBasicRemote().sendObject(message);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,7 @@ class StartWebSocket {
}

@OnMessage
fun onMessage(message: String, @PathParam("username") name: String) {
fun onMessage(message: String, @PathParam("name") name: String) {
println("onMessage> $name: $message")
}

/**
* Send a message to a remote websocket session
*
* @param session the websocket session
* @param message the message to send
* @throws IOException if there is a communication error sending the message object.
* @throws EncodeException if there was a problem encoding the message.
*/
@Throws(EncodeException::class, IOException::class)
fun sendMessage(session: Session, message: String) {
session.basicRemote.sendObject(message)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,7 @@ public void onError(Session session, @PathParam("name") String name, Throwable t
}

@OnMessage
public void onMessage(String message, @PathParam("username") String name) {
public void onMessage(String message, @PathParam("name") String name) {
System.out.println("onMessage> " + name + ": " + message);
}

/**
* Send a message to a remote websocket session
*
* @param session the websocket session
* @param message the message to send
* @throws IOException if there is a communication error sending the message object.
* @throws EncodeException if there was a problem encoding the message.
* @throws IllegalArgumentException if the message parameter is {@code null}
*/
public void sendMessage(Session session, String message) throws EncodeException, IOException {
requireNonNull(session, "session is required");

session.getBasicRemote().sendObject(message);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,7 @@ class StartWebSocket {
}

@OnMessage
fun onMessage(message: String, @PathParam("username") name: String) {
fun onMessage(message: String, @PathParam("name") name: String) {
println("onMessage> $name: $message")
}

/**
* Send a message to a remote websocket session
*
* @param session the websocket session
* @param message the message to send
* @throws IOException if there is a communication error sending the message object.
* @throws EncodeException if there was a problem encoding the message.
*/
@Throws(EncodeException::class, IOException::class)
fun sendMessage(session: Session, message: String) {
session.basicRemote.sendObject(message)
}
}

0 comments on commit d0e83ce

Please sign in to comment.