Estim Broker

The Estim Broker is a piece of software that facilitates connections between remote computers, to make it simple for people to stim remotely over the internet. Because configuring ports and firewalls is tricky, it's often simpler to allow both systems to connect outwards (most networks let just about anything out) and then connect them together on a server. That's what Estim Broker does. To read more about how it works in practise, look at this page. Here I'm going to describe the technical details.

Back to eStim index

How it works

Estim Broker is a pretty simple script, just over 300 lines of Perl, based on the simple chat server from the POE Cookbook with lots of modifications. It listens for (and accepts) incoming connections, and depending on the commands, sent and received, will bridge two of those connections together, then pass all data between them. It listens on TCP port 38746 (E-S-T-I-M).

The protocol is very simple. As with my extended Estim commands, all commands to the server begin with a ; at the start of a line. If a user is not connected to any other user, anything that is not a valid command is ignored. If they are connected, anything that is not a valid command is passed through.

An example session

Here's a simple session, where master@roughsex.org is connecting to slave@roughsex.org. Each system connects to port 37846 on the server, and receives the same response:

;info:estim broker 0.2 - 0 users registered - use ;help for assistance

They they send a register command, to sign in, for example

;register=master@roughsex.org

which is acknowledged by the server:

;registered:master@roughsex.org

The slave then does nothing; it's just waiting for an inbound connection. The master side issues a connection request with the command

;connect=slave@roughsex.org

and the server sends this message to the slave, indicating who is trying to connect:

;connect=master@roughsex.org

When the user of the slave system confirms they want to accept, they send the command

;accept=master@roughsex.org

Both sides then receive the message

;connected

and now all data (stim commands, status from the 2B) is passed between the two users. If either user disconnects for any reason, the message

;disconnected

is sent to the other party to let them know.

Command summary

There are more commands than just the ones shown there, and alternate responses. Here's a complete list, in alphabetical order

;accept
The accept command is used by the slave device to indicate that it wants to accept an offered connection. Once given, the connection between the two devices will be established. Pass back the user id of the person, as specified in the connect request.

;connect
Request a connection to another user. Pass their user id. If the user is found, there will be no response until they reply. If they accept a connection, the response will be ;connected but if they reject the request, the response will be ;denied

If the requested user is already connected to someone, or is not connected to the broker, the response will include their user name, and will be either ;busy or ;unavailable respectively, eg ;busy:slave@roughsex.org

A connect request cannot be made without registering first; if registration has not been completed, the message ;error:not registered will be sent

;end
This command ends the current connection between two parties, and sends a ;disconnected message to the other user, while still remaining connected to the broker service

;help
Displayed the broker's list of commands

;invisible
Hides the current user from the ;users command. This option is persistent, eg if you hide, you will be hidden the next time you sign in too, unless you have made yourself visible again

;quit
The same as ;end except that the connection to the broker is closed as well

;register
Register with the Estim Broker service, using an email address as an ID, eg ;register=master@roughsex.org

A successful result will display a ;registered message, eg ;registered:master@roughsex.org and a failure will return the response ;failed followed by a code and a descriptive message. The codes are presently 1 for no account found, 2 for subscription expired and 3 for banned, eg ;failed:2=subscription expired

;reject
Reject the offered connection. You must specify the user name, eg ;reject=master@roughsex.org and the user will receive the ;denied response

;users
Display the list of visible users registered on the broker. One line is returned for each user, starting with ;user, followed by ;total, which indicates the number of users (including invisible ones) registered, eg

;user:master@roughsex.org
;user:slave@roughsex.org
;total:2

;visible
The opposite of ;invisible, this command makes the currently registered user appear in the response to the ;users command. This option is persistent, across sessions.

Want to try it out?

I'm still testing the software, and there may be some tweaks, but if you want to try out the Estim Broker, please email nigel at roughsex.org. As mentioned above, because of the need to keep a server running, this will eventually become a feature for which people will have to pay a small fee, but anyone who helps test will get at least six months of free access after I make the changes to introduce subscriptions. Details about how the Broker is used in the apps are on this page.

Back to eStim index