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

WebSocket transport #2

Open
space55 opened this issue Oct 13, 2020 · 9 comments
Open

WebSocket transport #2

space55 opened this issue Oct 13, 2020 · 9 comments

Comments

@space55
Copy link

space55 commented Oct 13, 2020

Hello,

Is there any plan to support WebSocket transport with this library? I can dive in and see if I can implement and PR it, if it would be appreciated.

Thanks!

@sbinet
Copy link
Contributor

sbinet commented Oct 14, 2020

hi,

AFAIK, there are no plans to add websocket support.
but PR would be of course welcomed!

@space55
Copy link
Author

space55 commented Oct 14, 2020

I've got client-side WS support completed in my fork of the project. I completed that because I desperately needed it for what I was working on (did you know that your library can be easily compiled to WASM?), and will start working on server-side WS support soon.

@sbinet
Copy link
Contributor

sbinet commented Oct 14, 2020

as the main goal of that library was to provide a pure-Go implementation of ZMQ, being easily compiled to WASM isn't completely a surprise but it's still nice to know :)

@space55
Copy link
Author

space55 commented Oct 20, 2020

So, I've gotten as far as writing a client-side implementation of WebSocket transport. It's a really simple commit + fix, but it introduces another dependency. I'm not too sure how the opinion of additional dependencies fares, but in my mind at least, it doesn't entirely make sense to add a WebSocket dependency for those who are using IPC only. Is there a way to submodule it, or conditionally import?

Otherwise, would something like the ability to pass in functions structured like net.Dial make sense? Or some other way to modularize it.

The fork is under my account (https://github.com/space55/zmq4), and I'm happy to PR it if you'd like the changes now, or I can wait until I have server-side completed as well - up to you.

@sbinet
Copy link
Contributor

sbinet commented Oct 20, 2020

nhooyr.io/websocket seems like indeed quite a large dependency (looking at the additional entries to the go.sum fie, that is).

perhaps we could devise a plugin mechanism "a la database/sql to side-step this? (but explicitly registering a new transport mechanism instead of a side effect of blank importing some package)

WDYT?

@space55
Copy link
Author

space55 commented Oct 20, 2020

I'm definitely a fan of the idea of a plugin mechanism. I'm not quite sure how it would look from an implementation perspective, but I imagine it would be some sort of struct that is passed to an init function, much like from one of the MySQL drivers:

func init() {
	sql.Register("mysql", &MySQLDriver{})
}

I'm absolutely happy to implement this, but I can see a lot of very compelling reasons why you may prefer to. I shall follow your lead.

sbinet referenced this issue in sbinet-alice/zmq4 Oct 21, 2020
sbinet referenced this issue in sbinet-alice/zmq4 Oct 21, 2020
sbinet referenced this issue in sbinet-alice/zmq4 Oct 21, 2020
sbinet referenced this issue in sbinet-alice/zmq4 Oct 21, 2020
sbinet referenced this issue in sbinet-alice/zmq4 Oct 21, 2020
sbinet referenced this issue in sbinet-alice/zmq4 Oct 21, 2020
@sbinet
Copy link
Contributor

sbinet commented Oct 22, 2020

see go-zeromq/zmq4#94 for a possible transport plugin mechanism.

@sbinet sbinet transferred this issue from go-zeromq/zmq4 Oct 23, 2020
@sbinet
Copy link
Contributor

sbinet commented Nov 14, 2020

ping?

@space55
Copy link
Author

space55 commented Nov 15, 2020

Thanks, sorry for the late reply. I'll start working out WS & WSS for the plugin mechanism

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

No branches or pull requests

2 participants