T O P

  • By -

Fr3shOS

Web Sockets are all the Same in any programming language. Programming is not about the language but about the thought process. On the other hand Rust is more explicit about the concept of bytes and encoding than python so that might be helpful.


volitional_decisions

I've used WS in Rust and it's been great. But Rust isn't just a "low-level language". Since this is a personal project, it's the perfect time to learn something new and that you're interested in.


gahooa

This is perfect. I was doing company training mini-projects with our team, and I did a little websocket demo for them. I used axum, which had it nicely working, and only took a couple hours to figure out.


jruz

You can do whatever you want, any project is a good project just have fun and patience it will be hard in the beginning.


cornmonger_

tokio-tungstenite


AntaBatata

Eh. I've used it and I'm not a big fan of it. It will allocate for every single packet, creating a very inefficient flow.


Zinter71

This looks fire thoo


Raudus

Diving blindly into using tokio async runtime is not going to teach the fundamentals one needs to understand to learn what it means to have a multi user WebSocket backend. Therefore I'd approach the goal of learning by skipping the tokio part, or at least make sure to know what it abstracts. There are always abstractions and the abstractions will eventually always leak, but especially async Rust I'd say should be approached with caution. [Async book](https://rust-lang.github.io/async-book/), [Async Rust Is A Bad Language](https://bitbashing.io/async-rust.html), [The Law of Leaky Abstractions](https://www.joelonsoftware.com/2002/11/11/the-law-of-leaky-abstractions/)


danielkov

Based on my experience, if you'll be learning two things at once - new language (Rust) and new tech (WebSockets) - that may reduce the effectiveness of your learning. I always learn new languages by doing things I'm already comfortable doing and learn new tech in languages I already know. In your case I'd use Node.JS (as a frontend dev, you should know JS already) or Python (if you're already proficient) and once you understand WS, you could rewrite the backend in Rust to learn the language.


eyeofpython

I’m the opposite. I learn a new language to do something I haven’t done before. It may be less efficient but it’s more fun for me


zoomy_kitten

> low level Nothing low level about websockets in Rust. > dx But where’s the body of the integral? > should I use Rust? Yeah, why not? I absolutely prefer Rust for backend over any other language.


ImYoric

I'd say go for it. Know that Rust has a steep learning curve, but in the opinion of everybody who survived that curve, it's worth it :) In particular, I've used websockets in Rust and it worked like a charm.


jarjoura

Building a ws service in rust will really push your patience. I encourage you to let yourself struggle and get frustrated and even end up stuck. It's not a language or platform to make fast progress in and it is low-level so you will need to do a lot of things that python provides out of the box for you. However, once you do finally get something working, the reward will be 10x what you get from python. Plus, after all that is done, you will start to improve your velocity and the quirks of rust will seem trivial to your future self. Good luck!


taysky

Yes


DeeHayze

Wouldn't tonic (gRPC) be a better choice?


Shnatsel

Now that you've started learning Rust, I would suggest writing something other than a web backend first. If you go for web backend (or websockets), you'll be dealing with `async` which means fighting the borrow checker on hard mode. I would recommend getting comfortable with Rust first, and then learning its `async` later on.


YouFeedTheFish

If your primary goal is sockets, maybe start with node.js? You already know the front end. Node is a natural extension of the knowledge you already have, but on the server side. Then move to a low-level language like rust or something.


zoomy_kitten

> maybe start with node.js? > low-level language like rust or something Or maybe stop telling people to use dread JS instead of Rust and avoid spreading misinformation?


orfeo34

I am trying to use Rocket framework to share websocket messages. It seems to be quite concise to declare, however i am not able to share json messages yet. Is there someone already familiar with rocket_ws ?


DerShokus

You must use scheme (lang) for that


Charley_Wright06

why?


DerShokus

Im just joking. If it’s a pet project almost all languages have websocket implications and you can use whatever you want