Skip to content

Commit 2d51fe4

Browse files
committed
Add clarification of the task
1 parent d97472e commit 2d51fe4

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/vision/status_quo/alan_tries_a_socket_sink.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,17 @@ If you would like to expand on this story, or adjust the answers to the FAQ, fee
1010

1111
Alan is working on a project that uses `async-std`. He has worked a bit with `tokio` in the past and is more familiar with that, but he is interested to learn something how things work in `async-std`.
1212

13-
One of the goals is to switch from a WebSocket implementation using raw TCP sockets to one managed behind an HTTP server library, so both HTTP and WebSocket commands can be forwarded to a transport-agnostic RPC server. He finds the HTTP server `tide` and it seems fairly similar to `warp`, which he was using with `tokio`. He also finds the WebSocket middleware library `tide-websockets` that goes with it.
13+
One of the goals is to switch from a WebSocket implementation using raw TCP sockets to one managed behind an HTTP server library, so both HTTP and WebSocket RPC calls can be forwarded to a transport-agnostic RPC server.
14+
15+
In this server implementation:
16+
17+
* RPC call strings can be received over a WebSocket
18+
* The strings are decoded and sent to an RPC router that calls the methods specified in the RPC call
19+
* Some of the methods that are called can take some time to return a result, so they are spawned separately
20+
* RPC has built-in properties to organize call IDs and methods, so results can be sent in any order
21+
* Since WebSockets are bidirectional streams (duplex sockets), the response is sent back through the same client socket
22+
23+
He finds the HTTP server `tide` and it seems fairly similar to `warp`, which he was using with `tokio`. He also finds the WebSocket middleware library `tide-websockets` that goes with it.
1424

1525
However, as he's working, Alan encounters a situation where the socket needs to be written to within an async thread, and the traits just aren't working. He wants to split the stream into a sender and receiver:
1626

0 commit comments

Comments
 (0)