Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for slow client #483

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sergei-grigorev
Copy link

@sergei-grigorev sergei-grigorev commented Oct 16, 2017

I've tried to find a way to use netty callbacks and checks if netty buffer is ready to consume more information. Please review this small patch to #172

Example, how it could be used (where client: SocketIOClient, and ctx is context of netty ctx: ChannelHandlerContext)

if (client.isWritable) client.sendEvent("server_response", msg)
else {
  ctx.channel().config().setAutoRead(false)
  client
    .sendEvent("server_response", msg)
    .addCallback(r => if (r.isDone) ctx.channel().config().setAutoRead(true))
}

In deep it uses netty futures and promises but outside only pure java.util.concurrent.Future and some new interfaces in the package com.corundumstudio.socketio.concurrent in order to make it possible to use another implementation.

sergei-grigorev pushed a commit to sergei-grigorev/netty-socketio that referenced this pull request Oct 18, 2017
* add new method isWritable to check netty channel state
* add future based callback
sergei-grigorev pushed a commit to sergei-grigorev/netty-socketio that referenced this pull request Oct 18, 2017
* add new method isWritable to check netty channel state
* add future based callback
sergei-grigorev pushed a commit to sergei-grigorev/netty-socketio that referenced this pull request Oct 18, 2017
* add new method isWritable to check netty channel state
* add future based callback
* add new method isWritable to check netty channel state
* add future based callback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant