Похожие чаты

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 ответов

1 просмотр

> 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)

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

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

Hi everyone! I have a two-folded message to share today. First: updates and news, as we are being asked for those. We still want to go like we did the last 6 years: we w...
Marten | Unibright.io
31
Oh.... Admins at the main TG is already muted me. How many months Sir you muted me? Or forever if you are here @Janevietani @JohnnySonic
Charles Dar
28
Скажите, можно ли как-то "переместить" динамический массив из одной переменной в другую? Скажем, переместить из TList<> в TArray<>. Именно переместить, а не скопировать. Если ...
Eugene Krasnikov (ᴊɪɴ x)
37
комрады, че-та лыжы не едут var tmpFont: TFont; begin tmpFont:= TFont.Create; try case rgFontColor.ItemIndex of 0: tmpFont.Color:= clWindowText; 1: tmpFo...
Ed Doc
34
.model small .stack 100h .data a db 'Hello, World!', '$' ; исходная строка b db 20 dup(?) ; строка b с запасом на максимальную длину .code main: ...
Алексей -man
3
вопрос, кого посмотреть в ютубе или где почитать про указатели чтобы раз и навсегда запомнить зачем они нужны и как правильно ими пользоваться? поделитесь хорошими ресурсами, ...
-
14
М-да. Почему бы просто со stringlist не работать?
Michael Longneck
23
Интересно, нет ли какого-то способа получить из dll не адрес самой метки, а адрес со смещением?
The Bird of Hermes
54
Редактор листа Excel, по сути двумерный массив ячеек. Ячейка - это экземпляр класса, у нее всякие свойства, методы. Проблема в том, что количество используемых строк и колоно...
Sergey Bodrov
2
in one table i have two columns one is unique and another is duplicate. unique always unique and duplicate is that maybe has duplicate and may be not. now i want get Duplicat...
Mr Thieves
2
Карта сайта