theia-ide / sprotty

A next-gen web-based graphics framework
Apache License 2.0
138 stars 23 forks source link

[websocket] consider message splitting #182

Open JanKoehnlein opened 7 years ago

JanKoehnlein commented 7 years ago

Sometimes the size of a message gets bigger than the maxTextMessageBufferSize of the underlying websocket. On the server, we use MessageHandler.Partial<String> for received messages, but we haven't had a look at sent message so far.

We could use the analogous RemoteEndpoint.Basic.sendText(String, boolean) but that requires synchronized communication. If you mix it with asynchronous communication RemoteEndpoint.Async.sendText(String) you have to be prepared to get IllegalStateExceptions in case they overlap. If we stick to synchronous sending, we might hit performance issues.

The simplest solution seems to be to increase the buffer size, but that's not very universal.

Maybe there are better options?

JanKoehnlein commented 7 years ago

See also https://blogs.oracle.com/pavelbucek/is-websocket-session-really-thread-safe