Comments (7)
Hey @gedw99
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 didn't take that to count thanks for pointing that out.
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?
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.
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...
Looks good, but I need to confirm compatibility with the gorilla's custom system type. I'll look into it.
from surrealdb.go.
Heya, thanks for creating this feature request @ElecTwix and ongoing enthusiasm and efforts to improve the driver for everyone!
Thanks for your kind words @phughk.
I'm happy to help SurrealDB and everyone that uses it.
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 https://github.com/gobwas/ws
I know gobwas, it is great. For the test, I will also create an implementation for surrealdb to see the difference between both.
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?
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
from surrealdb.go.
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...
from surrealdb.go.
HI @ElecTwix
what's required to get the Nhooyr WS accepted though ? Maybe I dont understand what you're suggesting ?
from surrealdb.go.
HI @ElecTwix
what's required to get the Nhooyr WS accepted though ? Maybe I dont understand what you're suggesting ?
Hi @gedw99,
Nhooyr WS ready to merge; awaiting approval from SurrealDB team. for context is rejected once with: PR
from surrealdb.go.
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
https://github.com/gobwas/ws
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?
from surrealdb.go.
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:
-
Non-Idiomatic Go: Using gobwas might require writing code that deviates from idiomatic Go practices. This can lead to maintenance difficulties down the line.
-
Similar Performance with Idiomatic Go: The nhooyr implementation appears to offer comparable performance while adhering to idiomatic Go conventions, potentially making it a more sustainable choice.
-
Limited Client-Side Examples: gobwas seems to lack a comprehensive set of official examples for client-side WebSocket usage. This could make it challenging to integrate it effectively into our project.
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 :)
from surrealdb.go.
Related Issues (20)
- Feature: context.Context Support HOT 6
- Documentation: working with record links HOT 4
- Feature: Move and test `unmarshalMapToStruct(data map[string]interface{}, outStruct interface{})` HOT 2
- Bug: Re-connection to the DB HOT 2
- Bug: Broken Tests for Fetch HOT 5
- Bug: Unhandled errors in websockets can lead to panics HOT 4
- Bug: `Question or idea` Button HOT 2
- surrealdb Auth undefined HOT 1
- Bug: unexpected EOF on TestSurrealDBSuite/gorilla/TestUpdate HOT 1
- Documentation: The README file example is not usable with the latest main branch, neither with the latest version HOT 1
- Bug: The session has expired error when connecting to version 1.3.0 HOT 4
- Bug: stack overflow error in gorilla websocket with db version 1.3.0 HOT 4
- Feature: surrealML for golang
- Documentation: Add Documentation for .Live() func & other stuff related to LIVE queries HOT 6
- Change function does not exist HOT 3
- Feature: Add CBOR support HOT 2
- Bug: UnmarshalRaw panics when unmarshalling object HOT 3
- Feature: UPSERT
- Example fails in Beta 11 - panic: sending request failed for method 'change': Method not found HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from surrealdb.go.