Crossbar: HTTP Push Service

#1

Hi,

alright, I've added a "HTTP Pusher" to Crossbar:

https://github.com/crossbario/crossbar/wiki/HTTP-Pusher-Service

The Wiki page explains the most important things. To try it, update Crossbar to 0.9.5:

pip install -U crossbar

and follow the Wiki page.

This isn't a full-fledged, two-way HTTP/WAMP bridge, but covers an important (most important?) use case:

Enhance an existing app with real-time notifications

In other words, in covers the integration:

Exist. App --> HTTP/POST --> Crossbar --> WAMP/WebSocket --> Subscriber

This is minimal invasive to the existing app: use blocking code, use whatever HTTP-capable thingy you want, etc.

Cheers,
/Tobias

0 Likes

#2

Hi,

here is a complete example of adding real-time notifications to a classic Flask application:

https://github.com/crossbario/crossbarconnect/tree/master/python/example/flask

The same will work with any of the (blocking) WSGI frameworks out there (Django etc).

The code for adding push on the server side is essentially 3 lines:

1) Import
import crossbarconnect

2) Create pusher (once)
app.pusher = crossbarconnect.Client(PUSH_URL)

3) Push
app.pusher.publish(TOPIC_URI, ...)

It won't get any simpler. It's minimally invasive to the existing app.

Is that worth a blog post?

If so, what do you think would work best from a developer / dev. marketing perspective?

Cheers,
/Tobias

···

Am 11.06.2014 20:00, schrieb Tobias Oberstein:

Hi,

alright, I've added a "HTTP Pusher" to Crossbar:

https://github.com/crossbario/crossbar/wiki/HTTP-Pusher-Service

The Wiki page explains the most important things. To try it, update
Crossbar to 0.9.5:

pip install -U crossbar

and follow the Wiki page.

This isn't a full-fledged, two-way HTTP/WAMP bridge, but covers an
important (most important?) use case:

Enhance an existing app with real-time notifications

In other words, in covers the integration:

Exist. App --> HTTP/POST --> Crossbar --> WAMP/WebSocket --> Subscriber

This is minimal invasive to the existing app: use blocking code, use
whatever HTTP-capable thingy you want, etc.

Cheers,
/Tobias

0 Likes

#3

Yes, this is totally worth a blog post. Being able to push a notification from a celery task, a django view or admin script is very cool.

···

On Thursday, June 12, 2014 5:44:52 AM UTC+7, Tobias Oberstein wrote:

Hi,

here is a complete example of adding real-time notifications to a
classic Flask application:

https://github.com/crossbario/crossbarconnect/tree/master/python/example/flask

The same will work with any of the (blocking) WSGI frameworks out there
(Django etc).

The code for adding push on the server side is essentially 3 lines:

  1. Import

import crossbarconnect

  1. Create pusher (once)

app.pusher = crossbarconnect.Client(PUSH_URL)

  1. Push

app.pusher.publish(TOPIC_URI, …)

It won’t get any simpler. It’s minimally invasive to the existing app.

Is that worth a blog post?

If so, what do you think would work best from a developer / dev.
marketing perspective?

Cheers,

/Tobias

Am 11.06.2014 20:00, schrieb Tobias Oberstein:

Hi,

alright, I’ve added a “HTTP Pusher” to Crossbar:

https://github.com/crossbario/crossbar/wiki/HTTP-Pusher-Service

The Wiki page explains the most important things. To try it, update

Crossbar to 0.9.5:

pip install -U crossbar

and follow the Wiki page.

This isn’t a full-fledged, two-way HTTP/WAMP bridge, but covers an

important (most important?) use case:

Enhance an existing app with real-time notifications

In other words, in covers the integration:

Exist. App --> HTTP/POST --> Crossbar --> WAMP/WebSocket --> Subscriber

This is minimal invasive to the existing app: use blocking code, use

whatever HTTP-capable thingy you want, etc.

Cheers,

/Tobias

0 Likes

#4

Hi Tobias,

The link above has been moved somewhere else.

Can you also make calls to registered WAMP RPC using this?
I think this is a very important feature that will make WAMP acceptance be a lot easier to market.

0 Likes

#5

Hi Will,

we’ve extended things so that now all four WAMP actions are possible via HTTP bridge services.

The documentation for this is at http://crossbar.io/docs/HTTP-Bridge-Services/

Regards,

Alex

···

Am Samstag, 29. August 2015 16:25:27 UTC+2 schrieb Will Gunadi:

Hi Tobias,

The link above has been moved somewhere else.

Can you also make calls to registered WAMP RPC using this?
I think this is a very important feature that will make WAMP acceptance be a lot easier to market.

0 Likes

#6

Hi Alex,

Yes, I just found it out, it’s a very very useful feature.
I suggest you guys highlight it more.

I’ll write a blog on how I use this from my Flask-based platform.

Thank you,
Will

0 Likes

#7

Hi Will!

Glad you find this useful.

Could you please post a link to your blog post once it’s up?

Regards,

Alex

···

Am Samstag, 29. August 2015 17:31:05 UTC+2 schrieb Will Gunadi:

Hi Alex,

Yes, I just found it out, it’s a very very useful feature.
I suggest you guys highlight it more.

I’ll write a blog on how I use this from my Flask-based platform.

Thank you,
Will

0 Likes

#8

Hi Alex,

Question:
The Python code for publishing a message is this:

import crossbarconnect

client = crossbarconnect.Client("http://127.0.0.1:8080/publish")
client.publish("com.myapp.topic1", "Hello, world!", 23)

Do I need to call client.close() or something like that to close the connection?
What happen if I don't? Will each call make a connection to Crossbar?
Won't we end up with a lot of stale / unused connections?

0 Likes