I get what Websockets DO. What I don’t get is what they ARE. What does it mean to open a “persistent connection” over port 443? I always have a persistent connection because my computer is always hooked up to the internet and I can send messages any time. Also, how is it possible the server can send the client a message? Plz explain.
Conversation
Notices
-
Embed this notice
Alex Gleason (alex@gleasonator.com)'s status on Sunday, 12-Feb-2023 02:19:12 JST Alex Gleason - Doughnut Lollipop 【記録係】:blobfoxgooglymlem: likes this.
- Doughnut Lollipop 【記録係】:blobfoxgooglymlem: repeated this.
-
Embed this notice
Doughnut Lollipop 【記録係】:blobfoxgooglymlem: (tk@bbs.kawa-kun.com)'s status on Sunday, 12-Feb-2023 02:23:19 JST Doughnut Lollipop 【記録係】:blobfoxgooglymlem: @alex When a server and a client love each other very much… -
Embed this notice
Matty (matty@nicecrew.digital)'s status on Sunday, 12-Feb-2023 02:23:25 JST Matty Maybe it means that it allows a port to stay open and listen for messages to be forwarded to a router? -
Embed this notice
Alex Gleason (alex@gleasonator.com)'s status on Sunday, 12-Feb-2023 02:23:25 JST Alex Gleason @matty Maybe it’s like when your browser is loading a slow page and you get a white screen, except it stops there and keeps loading forever but you can still send messages back and forth.
-
Embed this notice
MattZ (colinsmatt11@gleasonator.com)'s status on Sunday, 12-Feb-2023 02:24:52 JST MattZ @alex Because it's not using HTTP anymore. In a full duplex connection both sides can send and receive data simultaneously. It's a different protocol on top of TCP Alex Gleason likes this. -
Embed this notice
Alex Gleason (alex@gleasonator.com)'s status on Sunday, 12-Feb-2023 02:26:41 JST Alex Gleason @colinsmatt11 But what does that protocol look like? I tell the server “stay with me”? Do I poll it to remind it I’m still there? How does it know when I disconnect?
-
Embed this notice
Alex Gleason (alex@gleasonator.com)'s status on Sunday, 12-Feb-2023 02:29:05 JST Alex Gleason @colinsmatt11 The fact this is efficient on this server is amazing to me. A server can’t server thousands of HTTP connections at once, but it can keep open thousands of websockets no problem?
-
Embed this notice
التنينوكس (dragnucs@social.touha.me)'s status on Sunday, 12-Feb-2023 02:29:54 JST التنينوكس @alex @colinsmatt11 Each side of the connection sends a heartbeat packet and each also has a timeout for receving each heartbeat. If the hartbeat drops after the timeout, then connection is considered closed. It stays open as long as there is a heartbeat.
Regular HTTP connections get closed as soon as the message gets completely sent.
Alex Gleason likes this. -
Embed this notice
Curtis Rock, SkD (curtis@social.teci.world)'s status on Sunday, 12-Feb-2023 02:32:40 JST Curtis Rock, SkD Establishing connections are more resource intensive than maintaining quiet persistent connections
Alex Gleason likes this. -
Embed this notice
Curtis Rock, SkD (curtis@social.teci.world)'s status on Sunday, 12-Feb-2023 02:35:42 JST Curtis Rock, SkD Long polling is kind of like that, where the connection timeout is infinite, and the server only responds to an HTTP request when something useful is ready to send. That allows the lowest latency for alert notifications from the server via HTTPS protocol
Long polling is not asynchronous, but low latency synchronous comms
Alex Gleason likes this. -
Embed this notice
Darryl Wright ?? (darryl@reasonable.world)'s status on Sunday, 12-Feb-2023 02:41:16 JST Darryl Wright ?? @alex I am so glad I get to contribute something. Old-school telecom programmer here: To put it simply it means that the connection is maintained by both ends, often with some sort of heartbeat sent back and forth at an interval to ensure it remains open and intact. That allows you to send data, streams, binary without any protocol overhead at the socket layer.
Alex Gleason likes this. -
Embed this notice
Bill St. Clair (billstclair@impeccable.social)'s status on Sunday, 12-Feb-2023 04:32:40 JST Bill St. Clair @alex Most TCP protocols have a client/server nature. The client connects, sends a request to the server, the server sometimes changes some internal state, then sends a response to the client. Even HTTP allows a connection to remain open after that, for sending further commands. Other than the initial request to connect and go to WebSocket mode, WebSockets have no concept of client and server. Each participant sends stuff, and the other reads and acts on it, sometimes sending something back. Alex Gleason likes this.