Open oberstet opened 9 years ago
Here is a transcription of the Python example:
#include <autobahn.h>
int main () {
// this is the Autobahn library entry point
ab_t ab;
// this represent a WAMP connection
ab_connection_t connection;
// initialize the library (once)
ab_init(&ab);
// create a new connection
ab_connection_create(&ab, &connection, "ws://localhost:8080/ws", "realm1");
// listener that will get attached to "open" event on connection
void on_open(ab_session_t* session) {
printf("session connected\n");
// close the underlying WAMP connection again
ab_connection_close(&connection);
}
// attach a listener to the "open" event on the connection
ab_connection_on_open(&connection, &on_open);
// now actually open the connection
ab_connection_open(&connection);
}
There are multiple open questions:
It seems totally possible to mimick the new shared core API in AutobahnPython and AutobahnJS also in an object-oriented style of C.
Having a core API shared across Python, JavaScript and C would be of tremendous value. It allows to apply WAMP and Autobahn API knowledge from tiny microcontrollers to the data-center to browsers and mobile.