0

I previously worked at workerman php to create a websocket server, but since I often work on java, I decided to study netty, I would like to know how to send a hello message to all users every 5 seconds, in workerman this is achieved by timers.

1

1 Answer 1

0

In Netty every EventLoop extends ScheduledExecutorService which means you could schedule a task to run every 5 seconds like this:

Channel ch = ...;
ch.eventLoop().scheduleAtFixedRate(() -> {}, 0, 5, TimeUnit.SECONDS);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.