-
Notifications
You must be signed in to change notification settings - Fork 26
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
Add support for tunnel.ping RPC #221
Conversation
Thanks for the PR! I'll leave @decentral1se to take a look at the code. My one suggestion would be to add an entry for this to Line 101 in 3d08227
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @KyleMaas! I'm not familiar with this endpoint but trust you need it for something. Do you have any links / refs for it? Np if not, just curious what you're planning 😸
It'd be great to have a test for this which I don't think would be hard to add, since the return is quite simple, no mocking etc. Just hit the endpoint and make sure you get back a datetime... could you also manage it? Feel free to ask any questions! 🙏 💯
#221 (comment) is a great suggestion too!
@decentral1se It was used in ssb-browser-core to keep the browser from closing connections. See: https://github.com/arj03/ssb-browser-core/blob/da9dd68fa945d192b40101b579153414f154c985/net.js#L78 We also ran into it in this thread:
Looking at the code, I think writing a test for this is beyond my current skill level. This project is my first time working with Go, and I am not particularly familiar with this codebase, either. If there's an example you could point me to of how to best test an RPC, that'd be great. I looked for any other tunnel tests that I could base a new test off of, like for One other question I had on this is that the original |
@KyleMaas I'll cover on the test, I think it might not be obvious given that there are a few moving parts that need to come together for this new test file. I'll ping you when I have something working. For the Sync/Asyne issue, I'm also still trying to figure out that! If you're getting working request/response calls, then let's assume we're good for now 🙃 Thanks for diving into Go coding, we need all the help we can get! |
Cool. I can't verify for sure that ssb-browser-core is getting "proper" responses to the RPC considering it pretty much just ignores what it gets back. But it does seem to be getting a response, which is really all it needed. I don't even know what else uses that RPC, so maybe the response format is actually irrelevant and the only thing it's actually used for is to test for whether or not it gets a response at all. Tests would be ideal to know for sure. Thanks! |
OK, after looking a bit deeper, I think we may have mixed up some terms. The original https://github.com/ssbc/ssb-tunnel goals was peering via a pub. However, the So, I think this "works" in the sense that it will keep your connections alive by returning something and looks like the MUXRPC call you need. But we've mixed up the I hope this is making sense. I'm inclined to leave this as-is, to support your use-case / experimenting and I will open an issue to track fixing this proper. I'm not sure what the real fix is after all... |
Wouldn't it still be applicable, though, since this project is a replacement for pubs and that was the original purpose of |
I do think it's fine to have the ping method here as well to make it consistent with a js pub that has ssb-tunnel installed. One thing that is a bit confusing is that there are 2 ping methods with different behaviors. As Kyle says, the tunnel.ping is really important for a browser client connecting to keep the connection alive, so it's really nice to see it added here. Also tunnel should not be only specific to rooms, it is nice that you can potentially tunnel through a pub as well. |
Can you elaborate more on "there are 2 ping methods with different behaviors" please? Because at this point I'd think we might as well harmonize them. |
Ah, I see: That returns a numeric value, but it's calculated differently. Which one is correct? |
My worry is that we have |
Shouldn't both rooms and pubs have |
I honestly don't know. Maybe we can continue on #231? Thanks. |
Don't know if this is the correct way to do this, but this adds support for the
tunnel.ping
RPC from the https://github.com/ssbc/ssb-tunnel package thatssb-browser-demo
uses.