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

Detect client bandwidth or whether WebSocket Connection is busy #146

Open
Kjos opened this issue Jan 12, 2018 · 2 comments
Open

Detect client bandwidth or whether WebSocket Connection is busy #146

Kjos opened this issue Jan 12, 2018 · 2 comments

Comments

@Kjos
Copy link

Kjos commented Jan 12, 2018

I'm using Webbit for streaming video over a websocket,
I want to apply some adaptive streaming, but I am scratching my head on how I can detect the bandwidth of the user, or just whether to check when data is still outgoing.
WebsocketConnection.send(data) will return immediately afaik.

Is there a way in Webbit to check whether a connection is busy? Is that even an option?

@Kjos Kjos changed the title Detect client bandwidth or WebSocket Connection is busy Detect client bandwidth or whether WebSocket Connection is busy Jan 12, 2018
@Kjos
Copy link
Author

Kjos commented Jan 13, 2018

Quick update; I've just added a message from the client to the server when the FPS is too low, in which case it will lower quality in a PID loop. This seems to work well, but if there is a better way it'd be glad to hear it.
I saw writeMessage returns a Future, but I didn't check whether it has a listener for bytes sent, because I think it was protected anyway.

@Kjos
Copy link
Author

Kjos commented Jan 13, 2018

So I've added a function to WebSocketConnection called sendFuture which returns the ChannelFuture. I then listen to operationComplete. operationComplete then sets a boolean whether the Channel is busy or not.
This doesn't work reliably however.

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

No branches or pull requests

1 participant