Replies: 3 comments 4 replies
-
| 
         I think we should have a stricter client-server separation: one page for the client, and as many server guides as the number of languages we'd like to cover, and they should be put together for a full client/server interaction. That is to say, Tte Deno page should not implement a client by itself, but should use the client implemented in the first guide (which probably means extracting it into the first guide). I think JS + C# is a good basis; not very sure about the Java one but probably we should too, just in the spirit of "don't remove any information"  | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         Thanks everyone for opening this discussion, I am really looking forward to your help to increase developers awareness about the way they've been using WebSocket and the impact it could have on user experience (no BFCache access) if the connection is not handled as expected. To clarify we are only talking about the aspects related to the JS connection handle from the Browser POV, the aspects I am proposing to increase awareness are: 
  | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         Taken care of in mdn/content#40931.  | 
  
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This came out of mdn/content#40188, which asks our docs to talk about making WebSocket code bfcache-compatible. This makes sense but I'm not sure noting it in the reference page for
WebSocketis the right approach, it feels more like a general usage guideline. Or at least, at a minimum, the usage guides we have for WebSockets should include this guidance.So my preferred option is to update our usage guides to include this.
The most obvious place to start is Writing WebSocket client applications, but this page is problematic because it claims to be taken from the complete example at https://github.com/mdn/samples-server/tree/master/s/websocket-chat, but that example is very old and not readily runnable.
Another more useful page is Writing a WebSocket server in JavaScript (Deno), which presents a complete minimal client/server application in Deno, and which does run basically out of the box.
So I think what I'd like to do is combine these two pages into a "Using WebSockets" guide, using the Deno example as the basis, but adding bfcache compatibility, and checking the whole thing into dom-examples, so people can run it.
I suppose one drawback is that we wouldn't have a separate "Writing a WebSocket server in JavaScript" page to sit alongside the "Writing a WebSocket server in C#" etc pages we have. I'm not all that keen on these "Writing a WebSocket server in $language" pages for various reasons, but I don't intend to get into that.
Beta Was this translation helpful? Give feedback.
All reactions