I never thought I'd use Socket.io ever again

Поділитися
Вставка
  • Опубліковано 16 гру 2023
  • This framework, changes that.
    Rust is quickly becoming one of my favorite languages for writing services.
    Become a better developer in 4 minutes: bit.ly/45C7a29 👈
    Video Links:
    Chatly Web: github.com/dreamsofcode-io/ch...
    Socketioxide: github.com/Totodore/socketioxide
    Finished Code: github.com/dreamsofcode-io/ch...
    Axum Issue (now resolved): github.com/Totodore/socketiox...
    Join this channel to get access to perks:
    / @dreamsofcode
    Come say hi on Discord: / discord
    Follow me on Twitter: / dreamsofcode_io
  • Наука та технологія

КОМЕНТАРІ • 133

  • @nostrorom
    @nostrorom 4 місяці тому +31

    5:17 "This is due to CORS. The natural predator of a web developer."
    Truer words have never been spoken

  • @TheRealKeyvan
    @TheRealKeyvan 5 місяців тому +31

    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.

    • @dreamsofcode
      @dreamsofcode  5 місяців тому +6

      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!

  • @BaronXOfficial
    @BaronXOfficial 5 місяців тому +6

    Great video! Excellent work, subscribed and looking forward to more Rust related content!

    • @dreamsofcode
      @dreamsofcode  5 місяців тому +1

      Awesome, thank you! I'm looking forward to creating more :)

  •  5 місяців тому +2

    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

  • @nbbhaskar3294
    @nbbhaskar3294 5 місяців тому

    Thanks for this awesome video, subscribed and looking forward to more content in this space.

  • @kiyov09
    @kiyov09 5 місяців тому

    Nice! I’ll be playing with this soon 🔥

  • @indramal
    @indramal 5 місяців тому +1

    This is why I subscribed to your channel. If you can, I suggest doing gRPC tutorial for client and sever sides.

  • @nathanoy_
    @nathanoy_ 5 місяців тому +2

    Awesome video, as always.

  • @ravingswe
    @ravingswe 4 місяці тому

    great video. the way you progress the project is easy enough to consume

  • @0lange
    @0lange 5 місяців тому

    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

  • @SOMEWORKS456
    @SOMEWORKS456 4 місяці тому +1

    You've done a tremendous job at explaining why socket shines in rust.

  • @jorgevillalta8487
    @jorgevillalta8487 5 місяців тому +5

    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.

  • @guray00
    @guray00 5 місяців тому

    Awesome video! How do you do this kind of animation? Do you use presentation tools or directly on the video editor?

  • @GeekMasher
    @GeekMasher 5 місяців тому +1

    Amazing project and amazing video!!

  • @dekrain
    @dekrain 5 місяців тому +10

    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.

    • @dreamsofcode
      @dreamsofcode  5 місяців тому +1

      You are 100% correct.

    • @IllllIIllllI
      @IllllIIllllI 4 місяці тому

      you can use Vite's server config to proxy all requests to the Rust server, skipping CORS entirely.

  • @noisetide
    @noisetide 5 місяців тому +51

    This was so easy to understand. Rust is amazing. I hope it will be used more in web development world.

    • @cryptic_daemon_
      @cryptic_daemon_ 5 місяців тому +2

      I hope to use it in the Embedded Systems World!!

    • @noisetide
      @noisetide 5 місяців тому +1

      @@cryptic_daemon_ Rust can be used anywhere. Hense a joke to rewrite everything in rust xD

    • @schroedingerundkatze
      @schroedingerundkatze 5 місяців тому +2

      @@noisetide If you are used to a hammer everything starts looking like a nail.

    • @noisetide
      @noisetide 5 місяців тому +2

      @@schroedingerundkatze Yes, but when you held a hummer and a screwdriver then everything is a screwnail

  • @joseburgosguntin
    @joseburgosguntin 5 місяців тому +4

    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.

    • @dreamsofcode
      @dreamsofcode  5 місяців тому

      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.

  • @ru31k32
    @ru31k32 5 місяців тому +2

    This man is awesome. :)

  • @theangelofspace155
    @theangelofspace155 5 місяців тому

    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

  • @kalempster
    @kalempster 5 місяців тому +2

    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?

    • @dreamsofcode
      @dreamsofcode  5 місяців тому +1

      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 :)

  • @IvanRandomDude
    @IvanRandomDude 5 місяців тому +4

    Is it worth it to still use socketio or equivalent libraries instead of using something like Pusher at this point?

    • @StingSting844
      @StingSting844 5 місяців тому

      That entirely depends on the time and cost you have for development

  • @PejmanRezaei-qv9lt
    @PejmanRezaei-qv9lt 5 місяців тому

    thanks for sharing such a cool video

  • @letscode9542
    @letscode9542 5 місяців тому

    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?

    • @dreamsofcode
      @dreamsofcode  5 місяців тому

      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 :)

    • @letscode9542
      @letscode9542 5 місяців тому

      @@dreamsofcode Thank you for the response. So its only for creates dependencies. I search for a similar plugin for go and node.

  • @01speed1
    @01speed1 5 місяців тому

    What is your vim and terminal configuration ?

  • @sujjee
    @sujjee 5 місяців тому +2

    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.

  • @Zitrussaft
    @Zitrussaft 5 місяців тому +85

    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

    • @orterves
      @orterves 5 місяців тому +19

      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

    • @henriquealmeida348
      @henriquealmeida348 5 місяців тому

      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.

    • @theintjengineer
      @theintjengineer 5 місяців тому +12

      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.

    • @vintagewander
      @vintagewander 5 місяців тому +6

      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

    • @theintjengineer
      @theintjengineer 5 місяців тому +12

      Hm, because every application is like Discord, right!!?
      Alright then. Our bad.

  • @kenzo3477
    @kenzo3477 5 місяців тому

    Please do a video on websockets on sending files to ws server.

  • @sshivam6955
    @sshivam6955 5 місяців тому

    I don't know what I watched but that terminal kept me focused.

  • @rando521
    @rando521 5 місяців тому +8

    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.

  • @cdbattags
    @cdbattags 4 місяці тому

    What's the addon for the Cargo warnings?

  • @yassineelmellouki9655
    @yassineelmellouki9655 4 місяці тому

    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?

    • @dreamsofcode
      @dreamsofcode  4 місяці тому +1

      Yes you can! You should be able to use the MongoDB driver for Rust!

    • @yassineelmellouki9655
      @yassineelmellouki9655 3 місяці тому

      @@dreamsofcode this worked thanks for the comment!

  • @panthonyy
    @panthonyy 4 місяці тому

    Jsut given me more motivation to learn Rust haha

  • @dadinhoschannel4003
    @dadinhoschannel4003 5 місяців тому

    Are there any updates to setup rust with Neovim from the past 8 months? Or that video is still up to date?

    • @dreamsofcode
      @dreamsofcode  5 місяців тому

      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.

  • @arnimlost
    @arnimlost 5 місяців тому

    Where do you get your desktop wallpapers from?

    • @dreamsofcode
      @dreamsofcode  5 місяців тому

      I get them off of Freepik! Some of them are free but others are licensed

  • @veritatas678
    @veritatas678 5 місяців тому

    I am not a rust guy, but this made me reconsider

  • @everythingbuttherain6323
    @everythingbuttherain6323 5 місяців тому +1

    damn, am i the only one who uses native websocket feature of axum

  • @Zamiell
    @Zamiell 5 місяців тому

    can you put the link to the github issue in the description?

    • @dreamsofcode
      @dreamsofcode  5 місяців тому

      Great idea. Doing it now! Looks like the issue also got resolved just before I released the video

  • @iyxan2340
    @iyxan2340 5 місяців тому

    9:51 How could you make the language server show the types?

    • @Sculman7
      @Sculman7 5 місяців тому +2

      I believe the feature is called "inlay type hints"

  • @RodolfoDeNadai
    @RodolfoDeNadai 5 місяців тому

    Cool!

  • @ChanceDinkins
    @ChanceDinkins 5 місяців тому

    What plugin are you using to show versions of crates?

    • @dreamsofcode
      @dreamsofcode  5 місяців тому

      I'm using the wonderful Saecki/crates.nvim plugin. I have a video on setting up Rust with Neovim which showcases it as well!

    • @ChanceDinkins
      @ChanceDinkins 5 місяців тому

      Awesome, thanks@@dreamsofcode.
      Your videos are great, btw. Definitely going to check out that video.

  • @ViciOuSKiddo
    @ViciOuSKiddo 4 місяці тому

    I kept waiting for you to say "WebRTC"

  • @otsov
    @otsov 4 місяці тому

    I need your nvim setup please

  • @rithvik_
    @rithvik_ 5 місяців тому

    What editor do u use?

  • @RenderingUser
    @RenderingUser 5 місяців тому +3

    Socketioxide
    ofcourse whyd i expect any other name

    • @v01d_r34l1ty
      @v01d_r34l1ty 5 місяців тому

      fax

    • @dreamsofcode
      @dreamsofcode  5 місяців тому

      It was so difficult to say 😭

    • @RenderingUser
      @RenderingUser 5 місяців тому +1

      @@dreamsofcode try thinking of carbondioxide when you say that word

  • @RenaudDenis
    @RenaudDenis 4 місяці тому

    😍

  • @landonwork675
    @landonwork675 5 місяців тому

    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.

  • @lukehjo
    @lukehjo 5 місяців тому

    Interesting.

  • @budgeter4807
    @budgeter4807 4 місяці тому

    What IDE is this?

  • @zeroows
    @zeroows 5 місяців тому +1

    Ur mixing JS with Java in the chat room :)

  • @JoeldaSilvaVicenteFilho
    @JoeldaSilvaVicenteFilho 5 місяців тому

    this video just made me have the urge to rewrite my node webserver in rust, it not even use Socket or websockets hahaha

  • @Alberto_Cavalcante
    @Alberto_Cavalcante 4 місяці тому

    +1 Subscriber

  • @otsov
    @otsov 4 місяці тому

    Why use node instead of rust, especially if already writing some parts in rust!

  • @gosnooky
    @gosnooky 4 місяці тому

    CORS - the natural predator of the web developer 🤣

  • @fortunatmutunda4194
    @fortunatmutunda4194 5 місяців тому

    I thought tide was your favourite

    • @dreamsofcode
      @dreamsofcode  5 місяців тому

      Y'all convinced me otherwise!

  • @lukasbelck4514
    @lukasbelck4514 5 місяців тому +1

    thx youtube for this recommenndation

  • @Viralvlogvideos
    @Viralvlogvideos 5 місяців тому

    what is this symbol :: ?

    • @theodoreprevot4964
      @theodoreprevot4964 5 місяців тому

      It basically propagate a potential error to the end of the scope rather than handling it directly.

  • @ibraheemhaseeb3660
    @ibraheemhaseeb3660 5 місяців тому

    rust looks scary but i am going to develop a web server with rust after my finals.

  • @Antonio-yy2ec
    @Antonio-yy2ec 5 місяців тому +1

    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 UA-cam 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 UA-cam. If I think correctly they have some kind of channel cloning feature to automatically copy anything you upload first to UA-cam

    • @dreamsofcode
      @dreamsofcode  5 місяців тому

      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.

    • @Antonio-yy2ec
      @Antonio-yy2ec 5 місяців тому

      @@dreamsofcode Sure!

  • @timschannel247
    @timschannel247 4 місяці тому

    are you from the 90s har har har

  • @raduking
    @raduking 5 місяців тому +1

    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.

    • @gileee
      @gileee 5 місяців тому

      ​@@ino98 Discord is buggy af

  • @Redyf
    @Redyf 5 місяців тому

    First! 🐧

  • @RoamingAdhocrat
    @RoamingAdhocrat 5 місяців тому

    pls can you pronounce it "sockettyoxide" tho

  • @0runny
    @0runny 5 місяців тому

    As soon as node or rpm is mentioned I switch off. Rust rules.

    • @Nemesis-db8fl
      @Nemesis-db8fl 4 місяці тому

      What about when u have to deploy apps in production with very less time

  • @TheOne11111
    @TheOne11111 5 місяців тому +2

    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.

    • @christopher8641
      @christopher8641 5 місяців тому +1

      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.

    • @robonator2945
      @robonator2945 5 місяців тому +2

      ​@@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.

    • @funkdefied1
      @funkdefied1 5 місяців тому

      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.

    • @dreamsofcode
      @dreamsofcode  5 місяців тому

      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.

    • @bear458ziif-s
      @bear458ziif-s 5 місяців тому

      @@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.