finagle / finagle-websocket

Finagle Websocket clients and servers
35 stars 23 forks source link

Added an example with an echo server and a console client #16

Open mkhq opened 8 years ago

mkhq commented 8 years ago

Started on a new examples sub-project which can be used to showcase how to use finagle-websocket and as a way to try out the new API. If this does not belong in the main repo, please let me know.

This commit contains a console client that reads a line of text from stdin and sends it to an echo server. The server uses a ServiceFactory to keep track of websocket sessions.

I have a couple of points on the API:

coveralls commented 8 years ago

Coverage Status

Coverage remained the same at 73.529% when pulling b8305a690f51ca40ec3d4f4dbe638b2db9d909d4 on mkhq:examples-asyncstream-client-server into 34d4bd81ad1d3a5f866b1c01bd61e2d785f4947d on finagle:develop.

coveralls commented 8 years ago

Coverage Status

Coverage remained the same at 73.529% when pulling 43c927bcc5d1c7883154e9eb445abaaaf39b11f9 on mkhq:examples-asyncstream-client-server into 34d4bd81ad1d3a5f866b1c01bd61e2d785f4947d on finagle:develop.

luciferous commented 8 years ago

Thanks @mkhq! I think it's nice to have examples, but we'll see what @sprsquish thinks.

I want to echo your thoughts about the SocketAddress on the client request. It doesn't really make sense, and I'm not happy with that API either. I have some ideas, but I want to flesh them out a little before presenting them.

The end of the AsyncStream means the same thing as connection closure. Because the stream is persistent, you can do something like this in the Service handler.

request.messages.foreach(_ => ()).ensure { println("Connection closing") }
sprsquish commented 8 years ago

Hey guys, sorry it's been so long. I'm adding @luciferous as an admin collaborator to the repo, @mkhq you're already on the team. I lack sufficient time and motivation to continue this project.

Thanks for picking up the torch so far and bringing the library into the present.

luciferous commented 8 years ago

@sprsquish Thanks! I'll do my best to attend to these issues regularly. We'll see what happens.