Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create chat example #77

Merged
merged 4 commits into from Jun 25, 2021
Merged

create chat example #77

merged 4 commits into from Jun 25, 2021

Conversation

tcoopman
Copy link
Contributor

This adds a very basic chat example. It's functional, but I'm definetely open for suggestions, changes,...

One question I have, a problem I saw, was that I sent messages to a closed websocket, which resulted in errors. I was wondering what would be the best way of handling this.
At the moment I do my best to remove the connections that will be closed, but I think race conditions are possible where you try to send something to a socket that's not there anymore.

@tcoopman
Copy link
Contributor Author

as discussed in: #75

@tcoopman
Copy link
Contributor Author

and a totally of topic question, but what editor do you use and does it manage the syntax highlighting ok? I'm using neovim and it completely breaks on the inline html (but I don't care too much about that), the issue is though that it doesn't recover and highlight the rest of the file with proper ocaml formatting 😢

@tcoopman
Copy link
Contributor Author

Anything else you want me to change?

@aantron aantron merged commit 9f6ae75 into aantron:master Jun 25, 2021
@aantron
Copy link
Owner

aantron commented Jun 25, 2021

Thank you! I'll make some minor edits and link the example from the example TOC.

@aantron
Copy link
Owner

aantron commented Jun 25, 2021

but what editor do you use and does it manage the syntax highlighting ok?

I use VS Code, and it eventually recovers from mis-highlighting HTML in an .eml.ml file. However, in "real" projects I use .eml.html, where the syntax highlighting is fine (OCaml code just doesn't get highlighted, basically). See also #55 (comment) as a related issue.

Here's an example of an .eml.html file on GitHub.

@tcoopman
Copy link
Contributor Author

Thanks. I'll probably also separate eml as much as possible from ml. I notice that vim recovers mostly as well, but it doesn't for this chat example.

@tcoopman tcoopman deleted the z-websocket-chat branch June 25, 2021 08:39
@aantron
Copy link
Owner

aantron commented Jun 28, 2021

Ok, the example is now linked, and loaded into the playground!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants