Skip to content

Instantly share code, notes, and snippets.

@supershabam
Created December 2, 2012 01:24
Show Gist options
  • Save supershabam/4186400 to your computer and use it in GitHub Desktop.
Save supershabam/4186400 to your computer and use it in GitHub Desktop.
Callback Service

#problem Web callbacks suck in development. Your dev box must be accessible from the web for the idea to work.

Specifically, when I'm working with TelAPI, I want to be able to develop locally. I have to set up an account in TelAPI and tell it what url to post data to when it has an event.

http://mydevbox.myproject.com:8080

If you are in a position to make your dev box accesible from the web, you're lucky. But, I do not always have this ability.

#solution - proxy What if you could set up a proxy server (accessible from the web) that your local dev box connects to. As your proxy server receives outside events, it forwards them on to you.

http://myproxy.myproxyserver.com:80/developer1

Some configuration required.

Locally, run a daemon that connects to the proxy server with a persistent web connection. When the proxy receives http data, it replays the connection data down to your locally running daemon... and yes, one more step, it then replays that http data to 127.0.0.1:80 (or whatever port you want).

This allows you to run locally behind whatever firewalls and inability to have a public IP address, but still receive events from a public host on the Internet, though it does require that middleman.

The communication only needs to be one-way to address my problem of web callbacks (public address -> local server). When my local server needs to respond, the API I am hitting is already available and there is no need to pass data through a proxy.

#server open source server that one could easily run on a publicly accesible box. Perhaps this problem is common enough to merit somebody hosting this server with a paid subscription for its use.

#client open source client that connects to a server and runs silently in the terminal.

#configuration

server

namespacing either through custom-subdomain.domain.com or via /path

client

which host port to forward data to (don't even need to forward data through localhost)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment