Java Spring Boot - WebSocket - Chat Application Example - Configure CORS

Поделиться
HTML-код
  • Опубликовано: 10 окт 2024

Комментарии • 47

  • @wiktorsadowski4797
    @wiktorsadowski4797 4 года назад +5

    Thanks man! It's first tutorial where author speak english well :D.

    • @CodeForgeYT
      @CodeForgeYT  4 года назад +1

      I love to hear that! Thanks :D

  • @Ashadow700
    @Ashadow700 3 года назад +2

    Goodness me, thank you! I've been trying to get my WebSocket to work for days now, and this is the first tutorial I've found that actually works.
    The only thing that I thought was missing was an explanation on how to push messages from backend to frontend, like a scheduled ping sent every 5 seconds or something like that, but that was easy to figure out after I had gotten your program up and running.
    Again, thank you!!

    • @CodeForgeYT
      @CodeForgeYT  3 года назад

      Hey! I am glad that tutorial helped you!

  • @bunthaideng2492
    @bunthaideng2492 3 года назад +2

    wow this awesome, sir!

  • @lehoa3809
    @lehoa3809 3 года назад +1

    It helped me a lot, you is the best, thank you

    • @CodeForgeYT
      @CodeForgeYT  3 года назад +1

      Glad to hear it helped you!

  • @abderrezakmohammedabed391
    @abderrezakmohammedabed391 2 месяца назад

    Thanks for the tutorial, however I would like to know how messages are stored in the database ?

  • @antoniohenriquedev
    @antoniohenriquedev 2 года назад +1

    Thanks for this tutorial!

  • @dshahnj
    @dshahnj 3 года назад +1

    Thanks for this tutorial. Please show us other dependencies you add in spring initializr.

    • @CodeForgeYT
      @CodeForgeYT  3 года назад +1

      You can find source code for this video in the description. Keep Coding!

    • @dshahnj
      @dshahnj 3 года назад +1

      Thanks 😊

  • @TheDavo233
    @TheDavo233 4 года назад +1

    Great tutorial ! It helped me a lot, thanks.

    • @CodeForgeYT
      @CodeForgeYT  4 года назад +1

      Cool to hear that! Happy to help.

  • @prikdj99
    @prikdj99 7 месяцев назад

    Great video, also, can I save chat with all messages, like if i will restart application all chats will be removed, how can I avoid it?

  • @bedouiwejdene1707
    @bedouiwejdene1707 3 года назад +1

    It helped me a lot, thank you

  • @tinashekadiki8885
    @tinashekadiki8885 3 года назад +1

    Awesome I appreciate it.

  • @ousmanegueye708
    @ousmanegueye708 Год назад +1

    Thanks frome Senegal, how to make for chat only one user

  • @mistyblunch
    @mistyblunch 3 года назад +1

    hero :3

  • @jean-baptistedioli1692
    @jean-baptistedioli1692 3 года назад +1

    Hello
    Thanks for the teaching :)
    Do you also have it, to send a message to a specific user in a secure mode ?
    Thanks for you answer :)

    • @CodeForgeYT
      @CodeForgeYT  3 года назад

      Hi! Thanks for feedback!
      Currently I don't have such application and I am not planning to make one, but who knows.
      What you mean by secure mode?

    • @jean-baptistedioli1692
      @jean-baptistedioli1692 3 года назад +1

      @@CodeForgeYT Thanks for answering :)
      I'm learning websocket and I don't know if when you get the connection from the client to it, it secure like can be application like Telegrams, whatsapp, viber or so one
      This is what I mean by secure.
      You really explain well, you really should think about to make it for one specific user ;) ;)

    • @CodeForgeYT
      @CodeForgeYT  3 года назад +1

      @@jean-baptistedioli1692 Sure thing!
      In this video we are not touching security subject.
      To make it secure you should implement some authentication before establishing connection via web socket. You also should use secure version of the protocol (wss) using ssl and stuff like this.
      Hope it helps! Keep coding!

  • @MrAlianzanet
    @MrAlianzanet 3 года назад +1

    Congrats for the video, I have a question, how I can deploy on Heroku, I tried but not successfully. Help me please.

    • @CodeForgeYT
      @CodeForgeYT  3 года назад +1

      Hey! Thanks for feedback! I don't have any video how to deploy spring boot application on heroku but it sounds like a great idea! There is a lot of tutorials how to deploy spring boot service on heroku in the internet, check them out! Good luck!

    • @MrAlianzanet
      @MrAlianzanet 3 года назад

      @@CodeForgeYT Yes, I know but I refer to this project in specific.

  • @andreeamaican818
    @andreeamaican818 3 года назад +2

    do you have a tutorial with the front end in react?

    • @CodeForgeYT
      @CodeForgeYT  3 года назад

      Yes I would like to create same application and make a tutorial using react, but right know i don't have microphone.

  • @boggavarapuharsha654
    @boggavarapuharsha654 Год назад

    bro if i have try to have a connection with websocket with have path that was not defined in spring api how can a spring api recognize the path request is not correct so that it have to through a 4040 error how to implement it bro

  • @shantajj
    @shantajj 3 года назад +1

    Hello, Just one question, how does it actually work if your not using any Rest Controllers? Can you provide a version where it has Rest Controllers ?

    • @CodeForgeYT
      @CodeForgeYT  3 года назад

      It works because we are using WebSockets, you don't need rest

  • @hkkabir2024
    @hkkabir2024 5 месяцев назад

    i am facing issue with stomp . u used ws end point

  • @praveenkumarindana5223
    @praveenkumarindana5223 3 года назад

    thanks for the video :) but the method handleTextMessage is getting called the number of times of sessions(if there are 5 sessions then the handleTextMessage is getting called 5 times).Any solution for this please.

    • @CodeForgeYT
      @CodeForgeYT  3 года назад

      Thanks for pointing it out. Right now I don't have time to investigate it. Is it problem with this solution or only your code?

    • @praveenkumarindana5223
      @praveenkumarindana5223 3 года назад

      @@CodeForgeYT thanks for the reply and right now my problem is if I want to perform some logic whenever the msg is triggered then iam unable to do it.... since the method is called multiple times my logic is also getting called multiple times.....hope you understood the problem and any solution for this would be highly appreciated thanks!

  • @andreymanaenko1638
    @andreymanaenko1638 3 года назад

    Change one string and could use any client without CORS error.
    webSocketHandlerRegistry.addHandler(getChatWebSocketHandler(), CHAT_ENDPOINT).setAllowedOrigins("localhost:4200");

  • @nilanjan54
    @nilanjan54 4 года назад +1

    Where I can get the source code

    • @CodeForgeYT
      @CodeForgeYT  4 года назад

      I have uploaded code on GitHub you can find link in video description! :)

  • @andreymanaenko1638
    @andreymanaenko1638 3 года назад

    Do you send every message to everybody ? Not good idea.

    • @CodeForgeYT
      @CodeForgeYT  3 года назад

      Why it it not good idea, any arguments? It is not direct message chat, it is old school chat where each user can jump right into the conversation.

    • @andreymanaenko1638
      @andreymanaenko1638 3 года назад

      @@CodeForgeYT Too simple.

    • @xTheDoctah
      @xTheDoctah 3 года назад +2

      @@andreymanaenko1638 Yeah its simple, but with this simple tutorial you can do something a bit more complex. E.g. Implementing security and stuff like that. This is a start point not the destination.