Тёмный

Websockets in Python 

APMonitor.com
Подписаться 76 тыс.
Просмотров 28 тыс.
50% 1

WebSocket is a protocol for machine-to-machine communication that keeps a TCP connection open for bi-directional passing of information. The websocket is a connection between two computers. The connection can be used to either send or receive information from either computer. The websocket can be configured as a server or client. A websocket server listens for requests and returns a result based on the input. The server can also function as a client by sending information without a specific request.
Websockets Overview: apmonitor.com/dde/index.php/M...

Наука

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

 

20 фев 2023

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 22   
@abdullahyousef3596
@abdullahyousef3596 6 месяцев назад
Thank you for this video, it was really helpful!
@kylanwalters37
@kylanwalters37 7 месяцев назад
Very helpful info! Thank you
@prasaddissanayake1718
@prasaddissanayake1718 7 месяцев назад
excellent
@Hallucinarix
@Hallucinarix 28 дней назад
is there a reason you nested the uri within the function rather than an outside variable that's easier to visually identify? (say when needing to change when going from dev to production)
@chenbruce318
@chenbruce318 2 месяца назад
thanks for such comprehensive sharing!! I have one question, are there any suggested solutions that allow me to deploy my websocket server to let external devices access it through link like wss:// ?
@rrc
@rrc 2 месяца назад
Yes, no problem on deploying it as a web service. Just open the firewall on port 443 to not block the connection.
@Hallucinarix
@Hallucinarix 28 дней назад
is there a reason you nest the uri within a function rather than being declared outside as a variable that can easier be visually identified when needing to be changed? (say going from dev to production)
@apm
@apm 28 дней назад
Great idea - it just adds an additional input parameter to the function, but makes the code more modular and reusable for other applications.
@IsraelAlfaro
@IsraelAlfaro 3 месяца назад
Thanks so much for this video! It was very helpful. I am now wondering, how could you introduce authentication in order to connect to the websocket server? e.g. as you would with a Bearer Token when using RESTful APIs. Thanks a gain! Cheers!
@apm
@apm 3 месяца назад
To introduce authentication to a WebSocket server, you have several options: authenticate during the initial WebSocket handshake by including a token in the URL or a custom HTTP header, authenticate immediately after the connection using the first message from the client, leverage existing session IDs, or use tokens from OAuth or external providers. Use WebSocket Secure (WSS) with TLS/SSL to ensure the security of the authentication tokens and data transmitted. The choice of method depends on your application requirements and architecture, and you should also consider the management of token expiration and renewal due to the long-lived nature of WebSocket connections.
@IsraelAlfaro
@IsraelAlfaro 3 месяца назад
@@apm thanks so much! Would you mind recommending another video/tutorial/post I could use as a reference, to follow along? Thanks once more!
@apm
@apm 3 месяца назад
@@IsraelAlfaro more information is on the Data-Driven Engineering course website, freely available at apmonitor.com/dde
@georgigeorgiev3970
@georgigeorgiev3970 9 дней назад
This works fine. But each client has its own socket with the server. Is there a way to make it like all clients see the changes other client does on server? For example having them connected to the same socket, or server sends info via each socket once DB changes?
@apm
@apm 8 дней назад
MQTT has a broker that serves as a database: apmonitor.com/dde/index.php/Main/MQTTProtocol MQTT is often used for devices that are intermittently connected and where fault tolerance is needed. OPC UA has server where values are stored: apmonitor.com/dde/index.php/Main/OPCTransfer OPC is used in industrial automation. Modbus has a server / client function: apmonitor.com/dde/index.php/Main/ModbusTransfer It is an older standard that is fast and reliable.
@Anorch-oy9jk
@Anorch-oy9jk 3 месяца назад
if my server also has to handle api calls, how can I combine that? I know how to asnyc it, but my issue is the server IP. Locally I use fast api and a ws endpoint. But once deployed with https protocol, the ws endpoint no longer works
@apm
@apm 2 месяца назад
You need to switch to wss instead of ws for https protocol.
@Anorch-oy9jk
@Anorch-oy9jk 2 месяца назад
@@apm managed to do it! The clients needed to do a handshake cause the server was secured hosted as https and so the ws endpoint also switched to secured wss.
@UncleDavid
@UncleDavid Год назад
can you make a tutoriel-if possible-on sending HTML over websocket without js
@DuneKraftwerk
@DuneKraftwerk 10 месяцев назад
Websocket is a library, you need a program to load this library, like js for instance and then sending a html strings will be possible
@Homelander-compV
@Homelander-compV 8 месяцев назад
bro why u speaking in 0.25
@apm
@apm 8 месяцев назад
Yes, I'm speaking slowly. Fortunately, RU-vid allows you to increase speed up to 2x :)
@upsenloyn
@upsenloyn 4 месяца назад
​@@apmgood one
Далее
OPC UA with Python
15:59
Просмотров 17 тыс.
Python Sockets Simply Explained
39:33
Просмотров 156 тыс.
Впервые дал другу машину…
00:57
AsyncIO, await, and async - Concurrency in Python
9:12
FastAPI - Вебсокеты (онлайн чат) #13
35:14
Don't Use Websockets (Until You Try This…)
6:46
Просмотров 288 тыс.
A Beginner's Guide to WebSockets
29:26
Просмотров 316 тыс.
Python Socket Programming Tutorial
49:43
Просмотров 1 млн
ИГРОВОВЫЙ НОУТ ASUS ЗА 57 тысяч
25:33
Acer Predator Тараканьи Бега!
1:00
Просмотров 239 тыс.