-
Notifications
You must be signed in to change notification settings - Fork 66
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
Feature: Replace Gorilla WS with Nhooyr WS #128
Comments
Hey @ElecTwix I also like https://github.com/nhooyr/websocket for many different reasons. The most useful for me was that it can work when you compile your golang to wasm. I see you have already jumped the gun and are doing it here: https://github.com/ElecTwix/surrealdb-custom.go. Are you planning to try to merge upstream If the SurrealDB maintainer wants to take it ? https://github.com/btwiuse/wsconn/blob/main/go.mod looks to be an adapter that supports both gorilla and nhooyr. its mint be another option... |
Hey @gedw99
I didn't take that to count thanks for pointing that out.
I'm a big fan of SurrealDB and would love to contribute. While PR #127 wasn't accepted, I'm open to creating PR that introduces Nhooyr WS to go driver with the SurrealDB team's vision if they're interested in the future.
Looks good, but I need to confirm compatibility with the gorilla's custom system type. I'll look into it. |
HI @ElecTwix what's required to get the Nhooyr WS accepted though ? Maybe I dont understand what you're suggesting ? |
Heya, thanks for creating this feature request @ElecTwix and ongoing enthusiasm and efforts to improve the driver for everyone! Overall, not opposed to changing the library. Personally I am not too familiar with the golang websocket space, but having had a search it seems that this library has a lot of performance benefits One thing that stands out is that Nhooyr supposedly handles Context, whereas I haven't immediately been able to see that in gobwas. If gobwas supports context then I think that may be preferable. And they should both work for WebAssembly, seeing as gobwas does not have dependencies that would prevent that https://github.com/gobwas/ws/blob/master/go.mod What do you think? |
Thanks for your kind words @phughk.
I know gobwas, it is great. For the test, I will also create an implementation for surrealdb to see the difference between both.
gobwas doesn't have context support out of the box but it can be implemented, the problem with gobwas seems like it will need more work to maintain but I'm not sure like I said second answer I will create and we can decide afterward |
I've been evaluating the gobwas WebSocket implementation. While it performs well, I have some concerns about its suitability for our project. Here's a breakdown of my findings:
I think we should go with nhooyr's version I will create PR replace gorilla ws still we can discuss I just want to gain sometime while waiting. @phughk I know you are not related to go but we started conversation if you have time could you check thanks :) |
Just adding this update here. Coder took over maintenance of the nhooyr/ws package a month ago. It appears that nhooyr developed it while working at Coder. They seem to be mature, well-funded etc.., which can only bode well for the package. The new repo is at https://github.com/coder/websocket |
Here's another option that seems promising |
Is your feature request related to a problem?
No, but it is will great when fixing #119
Nhooyr's implementation is more lightweight and idiomatic than Gorilla's
For instance, Turso's Go driver, a popular database library, demonstrates the effectiveness of Nhooyr's WebSockets implementation (https://github.com/tursodatabase/libsql-client-go).
Also golang std ws mention Nhooyr's ws as
Describe the solution
Remove Gorilla WS support and add Nhooyr WS support.
These changes will not affect function signatures and will improve the maintainability of the repository.
Alternative methods
There was an attempt to add Can along with Gorilla but it was rejected. #127. I considered using a soft switch but it is not feasible.
SurrealDB version
non related
Contact Details
[email protected]
Is there an existing issue for this?
Code of Conduct
The text was updated successfully, but these errors were encountered: