Похожие чаты

Hey guys, hope you're having a good day. I ran

into this problem and wanted to know your opinions on different solutions to it.
As you know in HTTP we often expect a request and a response and then connection is closed. But in raw TCP you don't know if the data you receive from a server is a response to a previous request or an event.
Basically what I'm trying to do is to have a non-closing (persistent) HTTP connection using raw TCP.
It's a chat application where I can send a request to search for a specific user and wait for response and also receive events related to a specific user.
What i'm currently doing is assigning id to requests that need responses and have a for loop waiting for responses to each request but I'm thinking this is the wrong way.
What do you think?

1 ответов

12 просмотров

> and then connection is closed. No, not necessarily. Usually, web servers implement the HTTP keep-alive feature which, obviously, keeps the underlying TCP/IP connection alive for a while > Basically what I'm trying to do is to have a non-closing (persistent) HTTP connection using raw TCP. Why? > It's a chat application where I can send a request to search for a specific user and wait for response and also receive events related to a specific user. So you want to build a chat app, right? There are several options, one of which is probably the simpliest: 1. use HTTPS for client->server communication (REQ/REP topology) 2. use HTTP/2 SSE (Server-Sent Events) for server->client communication (PUB/SUB topology) keep in mind that HTTP/2 SSE doesn’t work on old IE browsers, if that’s important to you (f*ck IE)

Похожие вопросы

Обсуждают сегодня

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта