Angular WebSockets教程



●訂閱即可觀看更多我的視頻,並點擊該「贊」按鈕以支持該頻道!

鏈接到教程:https://tutorialedge.net/typescript/angular/angular-websockets-tutorial/

鏈接到Angular Services教程:https://tutorialedge.net/typescript/angular/angular-services-tutorial/

●我的Twitter►⁦‪https://twitter.com/Elliot_f
●我的網站►https://tutorialedge.net。

27 comments
  1. Hi. I need help. How I do if the url of the websocket who I pass need an authentication? I have access to the websocket with http get method with an access token but I don't know how to do with a websocket authentication. Please someone help me!

  2. Thanks for this tutorial. I have created an application that has WebSocket and I have written code for that using this tutorial but I am facing an issue.
    The issue is when WebSocket connection gets disconnected in any case like due to the internet so How we can reconnect our WebSocket so that ChatService can subscribe or get the message from WebSocket like before it was getting. I know that socket.io is doing this by itself but WebSocket is not doing this. I can do it by Jquery and I have done this in our web application that is made by PHP and jquery but in angular and with Rxjs I am not able to do it so can you please help me?
    Please help me.
    Thanks in Advance

  3. If you are working with Angular 6, like me, install rxjs-compat and import 'rxjs-compat/Rx' instead of 'rxjs/Rx'. That should fix the reported error with the .map() function.

  4. Hi, thank you for your great tutorial 🙂
    I faced with an issue, could you help me?
    Because of now we have Angular 6 (with Rxjs 6), so we basically cannot use .map((response: MessageEvent) => blahh blahh) anymore, like at 9:15
    I think we can replace .map() with .pipe(map((response: MessageEvent) => blahh blahh)). It compiled successful. However, when I run my app, it throws an exception: TypeError: Cannot read property 'pipe' of undefined at new ChatService.
    Am I wrong in anything?

  5. Great tutorial and the scottish accent makes it even better 🙂 I'm not even doing angular, but tutorials for redux-observable are so scarse… If you could do one on that, it would be great, but in any case – great work, thanks and keep it up.

  6. good approach but what if I want to send message right after websocket is connected? – How to detect if there is the socket connection already established?

Comments are closed.