zeromq / jszmq

Javascript port of zeromq

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to work with pyzmq

wwj718 opened this issue · comments

Hi,
I want to make it work with pyzmq:

# python rep.py
import zmq
import time
import sys

port = "8001"
context = zmq.Context()
socket = context.socket(zmq.REP)
socket.bind("tcp://*:%s" % port)

while True:
    #  Wait for next request from client
    message = socket.recv()
    print("Received request: ", message)
    time.sleep (1)
    socket.send("World from %s" % port)

in my browser:

const zmq = require('jszmq');
const req = zmq.socket('req');
req.connect('ws://127.0.0.1:8001');

The error message is

WebSocket connection to 'ws://127.0.0.1:8001/' failed: Error during WebSocket handshake: net::ERR_INVALID_HTTP_RESPONSE

what should I do?

Thanks

You need to build libzmq from master with draft enabled and use ws:// on the python side as well

thanks!

commented

You need to build libzmq from master with draft enabled and use ws:// on the python side as well

Thanks for your help. Will it support wss(secure websocket client) also. If not incase any python zmq library available for that?