[nanomsg] Re: nanomsg sockets in browser?

  • From: Bent Cardan <bent@xxxxxxxxxxxxxxxxxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Wed, 13 Apr 2016 11:49:40 -0700

Doesn't work with Firefox. Could be a bug in that browser... 
https://bugzilla.mozilla.org/show_bug.cgi?id=1216237

Sent from my iPhone

On Apr 13, 2016, at 10:43 AM, Garrett D'Amore <garrett@xxxxxxxxxx> wrote:

With the ws:// url format, you should be able to communicate using a web 
browser / JavaScript implementation; *HOWEVER*, there isn’t any pure JS 
implementation of the nanomsg protocols that I’m aware of.  I had seen some 
work, and there are nodejs bindings (and iojs) for nanomsg, but a pure JS 
implementation is required for the browser.

That said, the protocols are simple.  Please have a look at the RFCs - in 
particular the sp-websocket-mapping-01.txt document covers the details of how 
data is transmitted.  Its pretty simple, since we can just use websocket 
framing directly.  If the data is binary, you’ll need to have binary capable 
websockets support (most browsers these days can).  Getting the *semantics* 
for nanomsg (retries, semantic behaviors) may be harder, but for many web 
apps you may simply not care about that.

I’d love to see someone put together a full pure JS implementation like I did 
in Go for mangos; sadly (or not!) my JS coding ability is limited (mostly by 
choice!), so its not something I’m really equipped to help with directly, but 
I can offer advice about the protocols and intended behaviors of the patterns.


On Wed, Apr 13, 2016 at 9:06 AM, Ranier VF <ranier_gyn@xxxxxxxxxxx> wrote:
Hi,

Start with this:
http://nanomsg.org/v0.8/nn_ws.7.html  ;

Best,

Ranier Vilela
Date: Wed, 13 Apr 2016 18:45:25 +0300
Subject: [nanomsg] nanomsg sockets in browser?
From: lacrima.maxim@xxxxxxxxx
To: nanomsg@xxxxxxxxxxxxx


Hello,

I am new to nanomsg, sorry if my question doesn't make any sense.

As far as I understand, nanomsg supports websockets as a transport layer. Do 
I correctly understand, that there should be some pure javascript 
implementation of nanomsg (or at least partial implementation that builds on 
top of WebSocket object) in order for it to be usable in the browser? Is 
there a library that implements this?

Or to ask the question from a different angle. If I bind a pub socket on a 
server to 'ws://addr:port', how would I subscribe to it from the browser?

-- 
Regards,
Maxim

Other related posts: