●訂閱即可觀看更多我的視頻,並點擊該「贊」按鈕以支持該頻道!
鏈接到教程: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。
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!
How do i can set the headers ?
This is same as an http request. If you send data from Client A, how you update it in Client B?
How can I do a onmessage event?
Why do you have the line 23, 13 repeated twice?
Nice tutorioool bro. 🙂
accent is great… so much better than New Jersey…
Writing code in the constructor is a really REALLY bad practice.
Great accent!
Very poor… returns "[object object]" .. just repeating parrot fashion a page exactly.
How is this a tutorial? He's just reading the code he types.
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
Thanks a lot @TutotialEdge. It helped me solve a big problem.. Keep the good work going..
killer tutorial, had to run 'npm i rxjs-compat' to get this to work
Excellent tutorial, i have a little question, How can I close the socket connection in a specific event?
property map does not exist in property message event on CHAT SERVICE
You should never subscribe directly to a subject but use asObservable()
But, how do you distinguish between different types of messages?"user-joined", "login", "logout" etc
help me –> Property 'map' does not exist on type
'Subject<MessageEvent>'
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.
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?
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.
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?
It is an interesting video but we need to understand a lot, you went to much fast for new in web socket and rxjs like me
can we add extra headers? also can we use WebSocketSubject, WebSocketSubjectConfig from Rx
sir, it is not working after production, after building the app and opening it in server, it is giving so many errors
What is the name of the editor you are using?