-
I use Gun as a mechanism to send webhooks, and I write code like My current problem is that the process that calls this post always sends There is no workaround for this, and I need to write code in the handle_info of the gen_server that calls the post to ignore {gun_tunnel_up, ConnPid, StreamRef, Protocol}}. Is there any better way to get around this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You shouldn't ignore it, it's there to inform you the tunnel is up and that you can send requests. It's sent after you call
You should treat |
Beta Was this translation helpful? Give feedback.
You shouldn't ignore it, it's there to inform you the tunnel is up and that you can send requests. It's sent after you call
gun:connect
or when the SOCKS connection is established. Until you receive this message, any request you send may not end up on the right server, especially when you usegun:connect
. For example:gun:connect
gun:get
with thetunnel
optiongun:connect
gun:get
that was already sent will not reach the remote endpoint but will instead be handled by the proxy as if it was a normal pipeline requestYou should treat
gun_tunnel_up
the same way asgun_up
in your gen_server: it is not ready to do requests until it receives it.