Hi Chris,
> Ran into another question related to Autobahn and CrossbarIO....
>
> Setup is AngularJS client + express/mongodb NodeJS app (i.e. MEAN) + crossbarIO using AutobahnJS...
>
> Any idea how can to get the clients IP address inside a autobahn rpc session callback running inside Node...? I want to be able to identify the unique public IP address of the user making the rpc call...
A procedure can be registered asking the router to provide caller
details at invocation time. E.g. in a Python WAMP component:
https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/wamp/basic/rpc/options/backend.py#L49
Currently, Crossbar.io provides information like WAMP session ID or
authid/authroles of the caller.
But no transport level information, like e.g. IP address (when the
caller was using a TCP based WAMP transport to connect to the router),
or even the WAMP transport type (WAMP-over-WebSocket-over-TCP,
WAMP-over-RawSocket-over-UnixDomainSockets, ..).
I've added an issue for that:
https://github.com/crossbario/crossbar/issues/142
It's more or less trivial to implement, but code must be written.
>
> If the client IP is available, any idea how it's obtained...? would it work in load balancing scenarios where the source IP address may be for upstream load balancers or proxies... would it look for something like an X-forwarded-for header to obtain the actual clients IP address...? Any insights you could provide would be appreciated...
Yes, if the client connects to the router via
WAMP-over-WebSocket-over-TCP (the usual WAMP transport), the IP that
Crossbar.io sees when a reverse proxy is in front is the IP of the proxy.
Additionally, it is possible to remember HTTP headers (x-forwarded) from
the initial WebSocket opening handshake. I've added that to the issue.
Can be done in Crossbar.io without changes to AutobahnPython
(WebSocketServerProtocol.onConnect() handler gets all HTTP headers from
WS handshake).
However, please keep in mind: WAMP is about decoupling.
If you rely on stuff like a caller IP in your app code, you introduce
coupling. Further, what if the caller doesn't connect over TCP at all?
Like over Unix domain sockets?
What do you plan to do with the IP? What is your actual goal?
>
> p.s. sorted out my issues with the Arduino Yun and Autobahn.... with a clean install everything works like a charm...
That is good to hear! I have the impression that the tutorial is quite
tricky to follow still ... this Yun fiddling etc. It's not your usual
modern Linux where everything works like a charm. Don't know how to make
it simpler/shorter though ..
Cheers,
/Tobias