[GH-ISSUE #20] How do i start my server but subscribe later? #8

Closed
opened 2026-05-05 10:56:41 -06:00 by gitea-mirror · 3 comments
Owner

Originally created by @ptheunis on GitHub (May 10, 2017).
Original GitHub issue: https://github.com/mmatczuk/go-http-tunnel/issues/20

Basically, i want to run 1 proxy and n clients.
But I am unaware of the clients at start-up.

Can I start the server in a goroutine and call subscribe on that server at a later time?

Originally created by @ptheunis on GitHub (May 10, 2017). Original GitHub issue: https://github.com/mmatczuk/go-http-tunnel/issues/20 Basically, i want to run 1 proxy and n clients. But I am unaware of the clients at start-up. Can I start the server in a goroutine and call subscribe on that server at a later time?
Author
Owner

@mmatczuk commented on GitHub (May 10, 2017):

Hi Paul,
the server supports this even with unsubscribing connected clients etc. yet the CLI does not. You can use the tunnel as a library and register clients yourself see https://github.com/mmatczuk/go-http-tunnel/blob/master/cmd/tunneld/tunneld.go for reference how this can be done.

I'll add another issue to add control over that while running. Maybe a REST API on a dedicated port WDYT would be the most convenient to use for you?

<!-- gh-comment-id:300621961 --> @mmatczuk commented on GitHub (May 10, 2017): Hi Paul, the server supports this even with unsubscribing connected clients etc. yet the CLI does not. You can use the tunnel as a library and register clients yourself see https://github.com/mmatczuk/go-http-tunnel/blob/master/cmd/tunneld/tunneld.go for reference how this can be done. I'll add another issue to add control over that while running. Maybe a REST API on a dedicated port WDYT would be the most convenient to use for you?
Author
Owner

@ptheunis commented on GitHub (May 10, 2017):

Right now i've solved it by adding a for {} to my main loop and running Server.Start() in a go func.
Either way a rest-api to add new clients would be great 👍

<!-- gh-comment-id:300634833 --> @ptheunis commented on GitHub (May 10, 2017): Right now i've solved it by adding a for {} to my main loop and running Server.Start() in a go func. Either way a rest-api to add new clients would be great 👍
Author
Owner

@mmatczuk commented on GitHub (May 11, 2017):

@pault84 I moved the REST API to https://github.com/mmatczuk/go-http-tunnel/issues/21. If you value the tunnel please consider starring it to help the adoption, thanks!

<!-- gh-comment-id:300706566 --> @mmatczuk commented on GitHub (May 11, 2017): @pault84 I moved the REST API to https://github.com/mmatczuk/go-http-tunnel/issues/21. If you value the tunnel please consider starring it to help the adoption, thanks!
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/go-http-tunnel#8
No description provided.