jakartaee / websocket

Jakarta WebSocket
https://projects.eclipse.org/projects/ee4j.websocket
Other
60 stars 41 forks source link

Add method to asynchronously send messages of unknown length #225

Open glassfishrobot opened 10 years ago

glassfishrobot commented 10 years ago

At the moment RemoteEndpoint.Async only has methods that send messages of a known length that are fully buffered in memory. It would be good if this could be extended to also include some way of sending messages piecemeal.

At the moment this can be accomplished using RemoteEndpoint.Basic using the stream and writer, however this requires the use of blocking IO.

As a suggestion as to what this API could look like maybe something like:

void sendPartialText(String message, PartialCallback back);

interface PartialCallback {

   void onWritePossible(TextSender sender);

}

interface TextSender {
  boolean isReady();
  void send(String text, boolean last);
}
glassfishrobot commented 6 years ago
glassfishrobot commented 10 years ago

@glassfishrobot Commented Reported by stuartdouglas

glassfishrobot commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA WEBSOCKET_SPEC-225