Really don't know how you do it. I had recently been thinking about using Tauri to create a chat app for fun with Rust, and then you just release this. Now I'm even more inspired.
Great video! I just want to say to be careful with CORS. Blindly accepting requests from different origins may cause some security problems to occur. Just mentioning that it should be dealt with properly is enough, but IMO it should at least be acknowledged.
I have this feeling whenever working with rust: it seems to do simpler tasks really well, but as soon as you want something a little bit more advanced than what's on the README it becomes a mix of experimental features and hard to read code (like when adding state in this video). Still, pretty good language, excited to see where it will go
I think that's the nature of an ecosystem that's still in its infancy - it's much the same situation in many languages and frameworks. The risk is usually that adopting these systems before they are proven can result in being stuck in an abandoned and incomplete system - at least with Rust it seems unlikely that adoption will slow down at all
I really wanted to like Rust but it looks ugly and always complex. Like, I spent like a year in C/C++ and I can get deep into complex codes, but I prefer not to nowadays. Life is too short for that. I love TS but for realtime servers and/or heavy performance usage it isn't an option. I use Kotlin in my current job and it's fine. Zig seems interesting, due to Bun. C# is an option but I didn't fall in love with it tbh.
Precisely. We did try using it here, but as soon as we dealt with large-scale, Enterprise-level projects, etc., Rust just couldn't _handle_ that somehow. We come to a point where C++ is way more appropriate, besides, from a particular point of complexity onwards, Rust becomes almost as complicated as C++, but with less maturity, and not nearly as many _experts_ in it as we have in C++. So, that's where we are - C++ still is our primary language and even the choice for our new projects. However, we do use Rust for some other smaller tasks, or some Networking, Parsing, De-/Serialisation, some Database stuff, and so on.
I agree, rust is more like if you already know what you're about to do, in each step by step how a feature is going to be implemented, then rust is really great. But for rapid prototyping, or tesing out new features implementation, then things start to get very complicated
Hey man, this is the first time I've really liked Rust! The way you've written this Rust code feels similar to how I write TypeScript. I kindly request you to start a series of Rust tutorials. I'm eager to explore low-level and system languages.
your golang chi video on net ninja was so healpful! Just a suggestions, but please make a small demo video showing off how you would use golang (chi router), htmx or html, and postgres together while containerizing the application with docker for deployment. I'm especially having a hard time understanding deployment step
I was was trying to achieve exactly the same but using tokio-tungstenite, which soon got out of control. But this feels just as writing more axum. I'll definitively re write it in socketioxide.
I'm a big fan of axum, and have been trying to set a basic web app with a postgres db, oauth and htmx. But the compile times haven't been very nice, especially when modifying askama template's, how do u deal with this without using React but still preserving type safe templates.
Compile times in Rust are brutal. It's tough without splitting up the front and backend, your best bet will probably be something like cargo-watch for hot reloading however.
damn i might actually do this, a socketio tutorial in python was the first ever web project or real project i did so this is a nice throwback. this might be me being used to programming but it took me 15minutes to understand the implementation in rust compared to 3hours in python.
Really good video!! Is there a way to authenticate when connect to socket? Looks like the latest versions cannot get handshakes headers to get a Bearer token...
Very nice, but is the room property really needed on the message object? If we're controlling in which room the user is on the server we know to which room the message should go, instead we trust the client that he provided the same room name as he is currently in? What if the client emits a join on room A event and emits a message event on room B?
You're 100% Correct. This would be another good example of using state to keep track of which room a socket is a part of. The framework also supports storing state per socket, which would be a good use case for this. Never trust the client :)
A video on how to setup the terminal and editor like yours in mac would be appreciated. I watched the on you made on tmux, we need the all in ome video for both nvim and tmux, as well as your choice of terminal emulator
Hey Dreams of Code, this was amazing and works great. Was wondering if its possible to create collections in MongoDB with this combo of rust and socketioxide?
Thanks for thoe Video. A little question: which "plugin" do you use vor nvchad to display the available/current Version in your'e cargo.toml file. Works this only for rust or also for golang mod files and js package.json files?
Rust tools is likely a little out of date now, I'd recommend sticking with the language server only! I'll probably do a follow up video in a few years time.
Dream of code can I ask you a huge favor, could you please also upload your content to Odysee too? I really enjoy your masterclasses and I’m always fascinated with every video you upload but I’m trying to avoid using RUclips spyware as most as possible. I know I’m only the 0.01% but uploading to this platform should not break your current one with RUclips. If I think correctly they have some kind of channel cloning feature to automatically copy anything you upload first to RUclips
Hey! Thanks for asking. I'll check it out. Do you happen to have discord? I'd love to chat with you a little more and find out more about Odysee from your perspective.
This could also be a tutorial on how to write unmaintainable software. Also Rust has the same old problem like C++, it doesn’t have JIT and it is plagued by poorly written async libraries, so it is not viable for enterprise server applications.
I never thought Rust code will be that ugly. Anyway, I need to learn it first to see how ugly it can be. So far, I'm not impress at all. I also want to know what the famous Rust borrow checker do.
Your ability to solve a problem should not be restricted by how ugly the code is that resolved it. Readability comes with experience with the language.
The video is using fully qualified names for the functions and structs he pulls in. It’s nice for a tutorial, but not very beautiful. It would be a little cleaner in the wild.
Rust can be very easy to make look gross. I would normally structure projects better than this in my normal day to day. I try not to refactor in videos, but it certainly makes the code look more messy.
5:17 "This is due to CORS. The natural predator of a web developer."
Truer words have never been spoken
Really don't know how you do it. I had recently been thinking about using Tauri to create a chat app for fun with Rust, and then you just release this. Now I'm even more inspired.
Tauri is so awesome. I've got a video in my backlog to do on it!
Let me know how your chat app turns out!
You've done a tremendous job at explaining why socket shines in rust.
Great video! I just want to say to be careful with CORS. Blindly accepting requests from different origins may cause some security problems to occur. Just mentioning that it should be dealt with properly is enough, but IMO it should at least be acknowledged.
You are 100% correct.
you can use Vite's server config to proxy all requests to the Rust server, skipping CORS entirely.
This was so easy to understand. Rust is amazing. I hope it will be used more in web development world.
I hope to use it in the Embedded Systems World!!
@@cryptic_daemon_ Rust can be used anywhere. Hense a joke to rewrite everything in rust xD
@@schroedingerundkatze Yes, but when you held a hummer and a screwdriver then everything is a screwnail
I have this feeling whenever working with rust: it seems to do simpler tasks really well, but as soon as you want something a little bit more advanced than what's on the README it becomes a mix of experimental features and hard to read code (like when adding state in this video). Still, pretty good language, excited to see where it will go
I think that's the nature of an ecosystem that's still in its infancy - it's much the same situation in many languages and frameworks.
The risk is usually that adopting these systems before they are proven can result in being stuck in an abandoned and incomplete system - at least with Rust it seems unlikely that adoption will slow down at all
I really wanted to like Rust but it looks ugly and always complex. Like, I spent like a year in C/C++ and I can get deep into complex codes, but I prefer not to nowadays. Life is too short for that.
I love TS but for realtime servers and/or heavy performance usage it isn't an option. I use Kotlin in my current job and it's fine. Zig seems interesting, due to Bun. C# is an option but I didn't fall in love with it tbh.
Precisely. We did try using it here, but as soon as we dealt with large-scale, Enterprise-level projects, etc., Rust just couldn't _handle_ that somehow. We come to a point where C++ is way more appropriate, besides, from a particular point of complexity onwards, Rust becomes almost as complicated as C++, but with less maturity, and not nearly as many _experts_ in it as we have in C++. So, that's where we are - C++ still is our primary language and even the choice for our new projects.
However, we do use Rust for some other smaller tasks, or some Networking, Parsing, De-/Serialisation, some Database stuff, and so on.
I agree, rust is more like if you already know what you're about to do, in each step by step how a feature is going to be implemented, then rust is really great. But for rapid prototyping, or tesing out new features implementation, then things start to get very complicated
Hm, because every application is like Discord, right!!?
Alright then. Our bad.
Great video! Excellent work, subscribed and looking forward to more Rust related content!
Awesome, thank you! I'm looking forward to creating more :)
This is why I subscribed to your channel. If you can, I suggest doing gRPC tutorial for client and sever sides.
Thanks so much for the awesome tutorial!
Hey man, this is the first time I've really liked Rust! The way you've written this Rust code feels similar to how I write TypeScript. I kindly request you to start a series of Rust tutorials. I'm eager to explore low-level and system languages.
your golang chi video on net ninja was so healpful!
Just a suggestions, but please make a small demo video showing off how you would use golang (chi router), htmx or html, and postgres together while containerizing the application with docker for deployment. I'm especially having a hard time understanding deployment step
I was was trying to achieve exactly the same but using tokio-tungstenite, which soon got out of control. But this feels just as writing more axum. I'll definitively re write it in socketioxide.
Thanks for this awesome video, subscribed and looking forward to more content in this space.
great video. the way you progress the project is easy enough to consume
I'm a big fan of axum, and have been trying to set a basic web app with a postgres db, oauth and htmx. But the compile times haven't been very nice, especially when modifying askama template's, how do u deal with this without using React but still preserving type safe templates.
Compile times in Rust are brutal.
It's tough without splitting up the front and backend, your best bet will probably be something like cargo-watch for hot reloading however.
Amazing project and amazing video!!
Thank you!
Nice! I’ll be playing with this soon 🔥
Built simple socket io backend recently and had to go the nodejs way as Go was too old. This is a great solution. Thanks for sharing
Awesome video, as always.
damn i might actually do this,
a socketio tutorial in python was the first ever web project or real project i did
so this is a nice throwback.
this might be me being used to programming but it took me 15minutes to understand the implementation in rust compared to 3hours in python.
Is it worth it to still use socketio or equivalent libraries instead of using something like Pusher at this point?
That entirely depends on the time and cost you have for development
Really good video!!
Is there a way to authenticate when connect to socket? Looks like the latest versions cannot get handshakes headers to get a Bearer token...
Very nice, but is the room property really needed on the message object? If we're controlling in which room the user is on the server we know to which room the message should go, instead we trust the client that he provided the same room name as he is currently in? What if the client emits a join on room A event and emits a message event on room B?
You're 100% Correct. This would be another good example of using state to keep track of which room a socket is a part of. The framework also supports storing state per socket, which would be a good use case for this.
Never trust the client :)
Awesome video! How do you do this kind of animation? Do you use presentation tools or directly on the video editor?
A video on how to setup the terminal and editor like yours in mac would be appreciated. I watched the on you made on tmux, we need the all in ome video for both nvim and tmux, as well as your choice of terminal emulator
I don't know what I watched but that terminal kept me focused.
This man is awesome. :)
Socketioxide
ofcourse whyd i expect any other name
fax
It was so difficult to say 😭
@@dreamsofcode try thinking of carbondioxide when you say that word
I kept waiting for you to say "WebRTC"
thanks for sharing such a cool video
Why use node instead of rust, especially if already writing some parts in rust!
damn, am i the only one who uses native websocket feature of axum
I am not a rust guy, but this made me reconsider
Hey Dreams of Code, this was amazing and works great. Was wondering if its possible to create collections in MongoDB with this combo of rust and socketioxide?
Yes you can! You should be able to use the MongoDB driver for Rust!
@@dreamsofcode this worked thanks for the comment!
What's your neovim setup?
Please do a video on websockets on sending files to ws server.
What is your vim and terminal configuration ?
Jsut given me more motivation to learn Rust haha
I need your nvim setup please
Ur mixing JS with Java in the chat room :)
Thanks for thoe Video. A little question: which "plugin" do you use vor nvchad to display the available/current Version in your'e cargo.toml file. Works this only for rust or also for golang mod files and js package.json files?
It is the Saecki/crates.nvim plugin!
I have a video on setting up Rust for Neovim which uses it as well if you need a reference :)
@@dreamsofcode Thank you for the response. So its only for creates dependencies. I search for a similar plugin for go and node.
What's the addon for the Cargo warnings?
Are there any updates to setup rust with Neovim from the past 8 months? Or that video is still up to date?
Rust tools is likely a little out of date now, I'd recommend sticking with the language server only!
I'll probably do a follow up video in a few years time.
CORS - the natural predator of the web developer 🤣
9:51 How could you make the language server show the types?
I believe the feature is called "inlay type hints"
can you put the link to the github issue in the description?
Great idea. Doing it now! Looks like the issue also got resolved just before I released the video
this video just made me have the urge to rewrite my node webserver in rust, it not even use Socket or websockets hahaha
Where do you get your desktop wallpapers from?
I get them off of Freepik! Some of them are free but others are licensed
I'd definitely use this... As soon as I fugre out how the heck to use state in Axum. I don't like not knowing what's going on behind the scenes.
What plugin are you using to show versions of crates?
I'm using the wonderful Saecki/crates.nvim plugin. I have a video on setting up Rust with Neovim which showcases it as well!
Awesome, thanks@@dreamsofcode.
Your videos are great, btw. Definitely going to check out that video.
I thought tide was your favourite
Y'all convinced me otherwise!
What editor do u use?
I use Neovim!
What IDE is this?
rust looks scary but i am going to develop a web server with rust after my finals.
Cool!
Dream of code can I ask you a huge favor, could you please also upload your content to Odysee too? I really enjoy your masterclasses and I’m always fascinated with every video you upload but I’m trying to avoid using RUclips spyware as most as possible. I know I’m only the 0.01% but uploading to this platform should not break your current one with RUclips. If I think correctly they have some kind of channel cloning feature to automatically copy anything you upload first to RUclips
Hey! Thanks for asking. I'll check it out.
Do you happen to have discord? I'd love to chat with you a little more and find out more about Odysee from your perspective.
@@dreamsofcode Sure!
thx youtube for this recommenndation
😍
what is this symbol :: ?
It basically propagate a potential error to the end of the scope rather than handling it directly.
+1 Subscriber
Interesting.
are you from the 90s har har har
1890s
This could also be a tutorial on how to write unmaintainable software.
Also Rust has the same old problem like C++, it doesn’t have JIT and it is plagued by poorly written async libraries, so it is not viable for enterprise server applications.
@@ino98 Discord is buggy af
pls can you pronounce it "sockettyoxide" tho
As soon as node or rpm is mentioned I switch off. Rust rules.
What about when u have to deploy apps in production with very less time
I never thought Rust code will be that ugly. Anyway, I need to learn it first to see how ugly it can be. So far, I'm not impress at all. I also want to know what the famous Rust borrow checker do.
Your ability to solve a problem should not be restricted by how ugly the code is that resolved it. Readability comes with experience with the language.
@@christopher8641 look, I get what you're saying, but that is some *_ugly_* code. Rust can be nice in places, but good looks ain't one of 'em.
The video is using fully qualified names for the functions and structs he pulls in. It’s nice for a tutorial, but not very beautiful. It would be a little cleaner in the wild.
Rust can be very easy to make look gross.
I would normally structure projects better than this in my normal day to day. I try not to refactor in videos, but it certainly makes the code look more messy.
@@dreamsofcode i didn't think it was that messy. rust just looks this way to people that are unfamiliar with it. i thought it was readable enough.
First! 🐧