Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Sending data over the server end of a WebSocket

Oh sorry missed the part about JMS

I have never used it, but you would probably do some
serialisation/deserialisation. What I do is, serialise a java object,
get its bytes and base64 the bytes and send it over the WebSocket as a
string, then on the other end un-base64 it then deserialise it. Works
like a charm, although with a bit of overhead obviously.


On Mon, Jan 18, 2010 at 9:25 PM, Erin Drummond <erin.dru@xxxxxxxxx> wrote:
> That was the WebSocket client I was using originally, but I used it as
> a base and rewrote it using xSocket for my purposes. It actually
> worked really well though.
>
> In the server, you have to create a WebSocketServlet. It spawns
> WebSocket objects which, when connected, have an Outbound object you
> can use to send messages back to the client.
>
> Details here: http://blogs.webtide.com/gregw/entry/jetty_websocket_server
>
> On Mon, Jan 18, 2010 at 6:29 PM, go canal <gocanal@xxxxxxxxx> wrote:
>> Hi,
>> I also just started playing around with WebSocket. I have not tried more
>> than 3kb.
>> Sorry, I do not have answers for your questions. But rather, I have a couple
>> of questions:
>>  - which WebSocket java client library are you using ?
>>     I find this : http://github.com/adamac/Java-WebSocket-client but have
>> not tried it.
>>  - I have a server supporting WebSocket and JMS; Anther program send data to
>> the server using JMS; all clients connect to the server using WebSocket. In
>> the server, how do I pass JMS messages to WebSocket ?
>>
>> rgds,
>> canal
>>
>> ________________________________
>> From: Erin Drummond <erin.dru@xxxxxxxxx>
>> To: jetty-users@xxxxxxxxxxx
>> Sent: Mon, January 18, 2010 10:56:44 AM
>> Subject: [jetty-users] Sending data over the server end of a WebSocket
>>
>> Hi,
>>
>> I am trying to get communications between two Java programs using a
>> Websocket. One has an embedded Jetty server running a WebSocketServlet
>> instance, and the other has a java implementation of a WebSocket
>> client.
>>
>> The client can connect to the server and send data, and the server can
>> send data back to the client through the Outbound object. This works
>> fine for messages smaller than 3 kilobytes.
>>
>> However, I would like to send messages much larger than that (they
>> contain base64-encoded binary data). If I try and send a message
>> larger than 3 kilobytes, I get:
>> java.lang.IllegalArgumentException: frame too large
>>         at
>> org.eclipse.jetty.websocket.WebSocketGenerator.addFrame(WebSocketGenerator.java:91)
>>
>> Since the limit of a WebSocket frame seems to be 3kb, how can I break
>> up a message and send it in multiple frames? Actually I dont really
>> understand the frame thing very well, as you can specify any number
>> for the frame (and the same number multiple times) and the message
>> still reaches the other end in exactly the same way. In my
>> understanding, a frame should be a "chunk" of data, but then why can
>> the user specify a number for it? You'd think that the underlying
>> network would take care of chunking up the data as it does for a
>> standard TCP socket.
>>
>> Can somebody please help me?
>>
>> Cheers,
>> Erin
>> _______________________________________________
>> jetty-users mailing list
>> jetty-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>
>>
>> _______________________________________________
>> jetty-users mailing list
>> jetty-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>
>>
>


Back to the top