Push oriented protocol with Tokio

I'm looking at implementing a client for a websocket-like protocol with Tokio, and I wonder if I have to roll my own protocol or if I can build on top of the ones from tokio_proto - Rust

The protocol works as follows:

  • The client can "fire and forget" requests. Some will have matching responses, some not.
  • The server will push unsolicited packets to the client, similar to push notifications.

My understanding is that the tokio-proto protocols are very much bound to a request/response model and thus not applicable for me. Am I right?

1 Like

I am curious about this too.

If you just want to build the client for your enjoyment please ignore my comment.

However, if you are looking for a solution for this problem have you looked into MQTT?
It is already implemented in C, and something also in Rust.

:beers:

And what is wrong with simply using websockets?

There is nothing wrong with MQTT or WebSockets, but in my case the server is not under my control, and is exposed on a Unix Domain Socket.

I went with implementing a Tokio codec and it's working well enough for my purposes so far.

Not under your control but you can pick the protocol. That sounds pretty odd. Nevertheless some web servers are able to listen on a unix domain sockets (like nginx), so websockets can still be used over uds.

Trust me, I have no hope of changing anything on the server side. But that's fine.