[undertow-dev] Websocket Data

Stuart Douglas sdouglas at redhat.com
Sun Dec 4 17:28:35 EST 2016


You don't create one, you use the one returned by channel.getIoThread().

Stuart

On Sat, Dec 3, 2016 at 1:17 AM, Devl Devel <devl.development at gmail.com> wrote:
> Thanks for the advice Stuart. Having tried a few approaches I didn't get
> very far with starting a new Thread. Please could you help sketch out some
> pseudo code to get and use the XnioIoThread particularly in relation to the
> ChatServer example?
>
> Using the WorkerThread requires
>
>  WorkerThread(final NioXnioWorker worker, final Selector selector, final
> String name, final ThreadGroup group, final long stackSize, final int
> number) {
>         super(worker, number, group, name, stackSize);
>         this.selector = selector;
>     }
>
> Do I need to create new NioXnioWorker workers, selectors etc?
>
> If you have any examples in git you can point me to that would be
> appreciated. Thanks for your help.
>
>
>
>
>
> On Tue, Nov 29, 2016 at 8:25 PM Stuart Douglas <sdouglas at redhat.com> wrote:
>>
>> You can use
>>
>> XnioIoThread.executeAtInterval
>>
>> One thing to be careful of though is that you need to make sure the
>> messages are actually being sent. If the messages are very large and
>> the client is very slow you can eventually run out of memory due to
>> messages being buffered.
>>
>> Stuart
>>
>> On Wed, Nov 30, 2016 at 2:33 AM, Devl Devel <devl.development at gmail.com>
>> wrote:
>> > Hi Guys
>> >
>> > I managed to implement a websocket server as per
>> >
>> > https://github.com/undertow-io/undertow/blob/master/examples/src/main/java/io/undertow/examples/chat/ChatServer.java
>> >
>> > Question is whats the best way to get the websocket to send data every 1
>> > or
>> > x second(x) irrespective of whether it got a message via
>> > onFullTextMessage?
>> >
>> > Any pointers would be appreciated.
>> > Thanks
>> >
>> >
>> > _______________________________________________
>> > undertow-dev mailing list
>> > undertow-dev at lists.jboss.org
>> > https://lists.jboss.org/mailman/listinfo/undertow-dev


More information about the undertow-dev mailing list