Тёмный

AWS WebSocket API (Real-time chat application using python) 

ListenToLearn
Подписаться 2,3 тыс.
Просмотров 14 тыс.
50% 1

In this session we will discuss about creating a real time chat application using AWS API gateway.
github.com/listentolearn/aws-...

Наука

Опубликовано:

 

7 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 68   
@bhushangosavi435
@bhushangosavi435 7 месяцев назад
Amazing tutorial! This is very underrated channel. Your content is really good. I never thought that it will be possible to implement end to end websocket chat application under 15 minutes, I always thought that it will be complicated. But you made it really simple. :)
@listentolearn2363
@listentolearn2363 7 месяцев назад
thanks! you made my day :)
@alexmatveev7246
@alexmatveev7246 Год назад
Hi, it is very strange you have so few subscribers... You make very high quality videos and use very good examples. It is real helpful to watch your videos. Thanks a lot! I wish you good luck!
@listentolearn2363
@listentolearn2363 Год назад
Thanks for your encouraging words.. this made my day :)
@alexmatveev7246
@alexmatveev7246 Год назад
@@listentolearn2363 thank you:) just finished with websockets chat example
@nitheshrao8499
@nitheshrao8499 Год назад
@@alexmatveev7246 emra adivasi
@joejiang8353
@joejiang8353 Год назад
Love the video! It is of very high quality
@listentolearn2363
@listentolearn2363 Год назад
Thanks, Joe :)
@tobiasp2664
@tobiasp2664 2 месяца назад
This really helped me out! Great quality, keep going :)
@listentolearn2363
@listentolearn2363 2 месяца назад
Thank you :)
@saradhapurushothaman1755
@saradhapurushothaman1755 2 года назад
Super very nice 👌👌👌👍🏽😊
@listentolearn2363
@listentolearn2363 2 года назад
Thanks a lot :)
@genewachtel5900
@genewachtel5900 6 месяцев назад
Great Video thank you!!
@listentolearn2363
@listentolearn2363 6 месяцев назад
Thanks :) Glad you found it useful.
@davioliveira5153
@davioliveira5153 Год назад
Nice tutorial! What did use to design the diagrams?
@listentolearn2363
@listentolearn2363 Год назад
thanks :) ppt.
@lucasmancini1283
@lucasmancini1283 Год назад
Hi,! great video. Do you know the easiest way to handle abrupt disconnections? Because when this happends i get an empty event in disconnect lambda function (so i can't delete the connectionid from the dynamodb). And btw, do you know if there is a way of brodcast a msg to all the connected clients without having to manually store the connectedId's? Thanks!!
@lucasmancini1283
@lucasmancini1283 Год назад
About the empty events, i get those when i connect and disconnect with postman without sending any messages.
@listentolearn2363
@listentolearn2363 Год назад
Hi Lucas, thank you. AWS documentation mentions that $disconnect is a best-effort event. So, it cannot guarantee delivery. Setting up a TTL on the dynamodb table might help in cleaning up the data. Unfortunately, we need the connectionId to send the messages and there is no other way to get the ids (as far as I know) without persisting them ourselves somewhere. You could try storing them in elastisearch or any other storage of your choice, if dynamodb doesn't seem reasonable for your usecase.
@KarimFayed-oy5oo
@KarimFayed-oy5oo 5 месяцев назад
Great video it's really helpful!! But what if I wish for messages from terminal 1 only to be sent to terminal 2 and from terminal 3 only to be sent to terminal 4 like private chats on an app.
@listentolearn2363
@listentolearn2363 4 месяца назад
Hi, Thank you :) One way to implement this is by making below changes to the setup: 1. Add an additional attribute to dynamodb which stores a user specific unique attribute (like userId) against each connection. 2. Include the userId to whom the message has to be sent to as one of the attributes to the message while sending the message 3. Query the dynamodb (instead of scanning) to get the specific connectionId against the userId 4. Send the message just to that one connection (instead of a for loop)
@KarimFayed-oy5oo
@KarimFayed-oy5oo 4 месяца назад
@@listentolearn2363 Thanks a lot. Really appreciate it ❤
@prabhudevbm2921
@prabhudevbm2921 7 месяцев назад
thanks-
@listentolearn2363
@listentolearn2363 7 месяцев назад
Welcome :)
@unconnu8481
@unconnu8481 2 года назад
nice video, what tool do you use to test your url 'workspace'
@listentolearn2363
@listentolearn2363 2 года назад
Thank you :) the tool used to test in this video is postman www.postman.com/downloads/
@_amitmalik
@_amitmalik 10 месяцев назад
if i had to only make this peer to peer chat, rather than a brodcast chat, will this similar outlined process via websockets lambda be an ideal practice to go through, if yes, what changes should be made in the vedio, or if you can create one such vedio about same about peer to peerchat, that would be so good.
@ejmurc
@ejmurc 10 месяцев назад
p2p could be implementing by tracking down a certain user's connection ID or user ID and only pushing the message to them (rather than pushing the message to all of them).
@listentolearn2363
@listentolearn2363 10 месяцев назад
Hi Amitism, Thanks for your interest. One way to implement this is by making below changes to the setup: 1. Add an additional attribute to dynamodb which stores a user specific unique attribute (like userId) against each connection. 2. Include the userId to whom the message has to be sent to as one of the attributes to the message while sending the message 3. Query the dynamodb (instead of scanning) to get the specific connectionId against the userId 4. Send the message just to that one connection (instead of a for loop)
@Matt-kc9xr
@Matt-kc9xr 8 месяцев назад
If the Websocket is public facing how do you deal with authorisation of users? As I am aware you cannot use custom headers in websockets to securely transfer the JWT.
@listentolearn2363
@listentolearn2363 7 месяцев назад
Hello, you could make use of lambda authorisers to control who can invoke your apis. you will be able to access the headers.
@maxsadler7231
@maxsadler7231 7 месяцев назад
@@listentolearn2363 If a client is making a http upgrade request, you will not be able to access typical authentication headers, as most browser WebSocket clients do not allow for custom headers. If you want to pass a JWT, you will need to pass it as a query param in the URL.
@SivaKumar-oq8em
@SivaKumar-oq8em Год назад
This was a nice tutorial, Can I know how to implement this API to a python code and make a chat application and if possible can you tell me what is to be learned for it?
@listentolearn2363
@listentolearn2363 Год назад
Thanks for your support. Here is the python code reference - github.com/listentolearn/aws-websocket-api
@nainaarabha9186
@nainaarabha9186 Год назад
I have one doubt. Can we host multiple kafka producers in one ec2 instance?
@listentolearn2363
@listentolearn2363 Год назад
Hi nainaarabha, apologies, I dont have much experience with kafka. however, this aws documents seems to be a good source - aws.amazon.com/blogs/big-data/best-practices-for-running-apache-kafka-on-aws/ and as per this, aws recommends one producer per instance per az.
@gabrielgarciamartinez5256
@gabrielgarciamartinez5256 Год назад
It shows me the error 502 bad gateway when i try to connect to the api. Do you know why this can happen? Edit: i think It will run if i change the return of the lambda fuctions
@listentolearn2363
@listentolearn2363 Год назад
Hi Gabriel, Could you please check the cloudwatch logs and let me know what you see there? If you don't see any errors there, then please enable the logging at api gateway level and check the logs there to know more about the error.
@gabrielgarciamartinez5256
@gabrielgarciamartinez5256 Год назад
​@@listentolearn2363 Hi! I have checked the cloudwatch to see the errors. I have connected your implementation with iot core and with a website made with the S3 module. It works perfectly, thanks a lot.
@suryaprakashsharma2165
@suryaprakashsharma2165 5 месяцев назад
@@listentolearn2363 what type error are in cloudwatch logs?
@rushikeshdhajal8762
@rushikeshdhajal8762 Год назад
Nice tutorial !! Very informative .. Can you please confirm that can we do this in free tier account ??? Or is there any charges if we create this environment ??
@listentolearn2363
@listentolearn2363 Год назад
Thank you! glad you found it useful. yes, this is free for free tier account. However, there are restrictions on the number of messages and connection minutes per month, see below 1M REST API CALLS RECEIVED | 1M HTTP API CALLS RECEIVED | 1M MESSAGES | 750,000 CONNECTION MINUTES per month please see here for more details - aws.amazon.com/api-gateway/pricing/
@nitheshrao8499
@nitheshrao8499 Год назад
It's free for SC ST caste.
@chakravathyvas1163
@chakravathyvas1163 Год назад
Can you help me with low level and heigh level demo on AWS API gateway
@listentolearn2363
@listentolearn2363 Год назад
sure, here are few links for API gateway related content - AWS API Gateway | REST API for CRUD operations - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-mQov1eetSec.html AWS API Gateway | Lambda and Cognito Authorizers - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Q5RwxhCONy8.html
@chakravathyvas1163
@chakravathyvas1163 Год назад
I have tried with same lambda code for websocet It's getting error 500 in postman tool Can u help me with code
@listentolearn2363
@listentolearn2363 Год назад
Please check cloudwatch logs to get more details about the error.
@user-ow4wj6sr9h
@user-ow4wj6sr9h 11 месяцев назад
I need to send to different chatRooms , How this can be done
@listentolearn2363
@listentolearn2363 11 месяцев назад
This chat application will work for multiple chat rooms. It uses the id stored in dynamodb against each connection to send out the messages.
@HunchoStreamz
@HunchoStreamz Год назад
Thank you for this. Is this free or is there a charge? If there is a charge, how much is it?
@listentolearn2363
@listentolearn2363 Год назад
Hi Suave, Thanks for your support. You are charged for what you use and the cost depends on number of requests per month and the total number of connected minutes. Also, the price varies based on the aws region where the websocket api is setup. Exact costs can be found here - aws.amazon.com/api-gateway/pricing/
@madiwalappalagali2752
@madiwalappalagali2752 Год назад
how to add 5GB of In-Memory Cache in websocket API?
@listentolearn2363
@listentolearn2363 Год назад
Hi Madiwalappa, There does't seem to be any caching options available at websocket api gateway level. If you are using lambda as the integration for your routes, you could add caching within lambda. There are several options for that like lambda extension. However, if you are using rest api then there are caching options available at the api gateway level. Thanks.
@suryaprakashsharma2165
@suryaprakashsharma2165 5 месяцев назад
Hello Dear Mam, I have got this error, please tell me how to resolve this problem [ERROR] TypeError: '_Environ' object is not callable Traceback (most recent call last): File "/var/task/lambda_function.py", line 11, in lambda_handler TableName = os.environ('WEBSOCKET_TABLE'),
@listentolearn2363
@listentolearn2363 5 месяцев назад
try this pls - TableName=os.environ['WEBSOCKET_TABLE']
@suryaprakashsharma2165
@suryaprakashsharma2165 5 месяцев назад
Hello mam, I have solved this problem but there is one occurred again which is {"message": "Internal server error", "connectionId":"R1CnEcJtoAMCKIQ=", "requestId":"R1C_kEvEoAMF5qg="} while sending the message
@listentolearn2363
@listentolearn2363 5 месяцев назад
Could you please check the cloudwatch logs to get more details about the error?
@khoatruongang2001
@khoatruongang2001 4 месяца назад
HI did you manage it?
@gigachad6844
@gigachad6844 Год назад
Please make one lambda function to send message to one person only
@listentolearn2363
@listentolearn2363 Год назад
Hi GigaChad, Thanks for your interest. One way to implement this is by making below changes to the setup: 1. Add an additional attribute to dynamodb which stores a user specific unique attribute (like userId) against each connection. 2. Include the userId to whom the message has to be sent to as one of the attributes to the message while sending the message 3. Query the dynamodb (instead of scanning) to get the specific connectionId against the userId 4. Send the message just to that one connection (instead of a for loop)
@ashishwaykar2838
@ashishwaykar2838 Год назад
Mam, i have an offer for you . can you please help me to configure my web app . I'll pay you for that.
@listentolearn2363
@listentolearn2363 Год назад
Thanks for your offer. However, I am focusing only on making video content at this time..
@ashishwaykar2838
@ashishwaykar2838 Год назад
what ammount you should take expect to i pay the other guy for that work ? for configure my server please help me to take decision ! my budget is $20-$30
@ashishwaykar2838
@ashishwaykar2838 Год назад
@@listentolearn2363 & my work is too small like i just need an SSL with websockets
@nitheshrao8499
@nitheshrao8499 Год назад
@@ashishwaykar2838 bro i had to sell my house and my mother's bangles for that project.Please don't fall for such traps.
Далее
Working with WebSockets on AWS
30:48
Просмотров 35 тыс.
What turned out better to repeat? #tiktok
00:16
Просмотров 1,8 млн
Luiza Rasulova #luizarasulova
00:37
Просмотров 814 тыс.
AWS Fooled Devs & Sabotaged The Industry | Prime Reacts
21:47
Websockets in NestJs (Real-Time Chat App)
24:51
Просмотров 1,9 тыс.
WebSocket in NodeJS | Socket.IO - Real Time Messaging
32:27
What are Serverless Apps and How to deploy one on AWS
21:27
AWS API Gateway | REST API for CRUD operations
16:03
ОБСЛУЖИЛИ САМЫЙ ГРЯЗНЫЙ ПК
1:00