autobahn

How to get the reactor from ApplicationRunner in autobahnPython

杀马特。学长 韩版系。学妹 提交于 2019-12-11 05:18:20
问题 I have an autobahn client using the ApplicationRunner class from autobahn to connect to a WAMP router (crossbar). In the main section it attaches my ApplicationSession class "REScheduler" like this: if __name__ == '__main__': from autobahn.twisted.wamp import ApplicationRunner runner = ApplicationRunner(url=u"ws://localhost:8080/ws", realm=u"RE_acct") runner.run(REScheduler, start_reactor=True, auto_reconnect=True) Now I need the reactor that the application runner started for other purposes

Autobahn cannot import name error

耗尽温柔 提交于 2019-12-10 15:08:59
问题 I have installed twisted and Autobahn websocket by using pip install twisted pip install autobahn But when I import any of the factories from Autobahn, I get the cannot import name error. >>> from twisted.internet import reactor >>> from autobahn.websocket import WebSocketClientFactory Traceback (most recent call last): File "<console>", line 1, in <module> ImportError: cannot import name WebSocketClientFactory Is there anything I am missing? Here's the pip freeze Twisted==13.2.0 Twisted-Core

Websocket multiple Channels vs. One Channel + Server Side handling [GroupChat]

不问归期 提交于 2019-12-10 13:36:48
问题 Let's say we want to create private chat rooms, where user can chat in small groups. A user can join multiple / x groups. In each case, I need to create a unique group on the server and subscribe user to these. Which approach is the recommended / more performant way: [1] On the server side, I create a Room class and add new room channels for each group chat, e.g. "chats/room-asdhqk1", "chats/room-fwuefhw1", "chats/room-awsdhqwd2". Now, some specified users can join this channel and are added

How to up to date poloniex orderbook via push api (WAMP protocol)

空扰寡人 提交于 2019-12-08 11:14:47
问题 I making software for scalping on poloniex.com To do this, I need to have fresh information about order book. API DOCUMENTATION said about push api. As i understand right it work like that: Use returnOrderBook (public method API) for getting snapshot Take sequence number (seq key) from responce Subscribe to push api with sequence number from snapshot Recive fresh data and make correction on snapshot data. <?php namespace Crypto\Scalper\Cli; use AppConfig; use Monolog\Logger; use Monolog

How to asynchronously read data via modbus/TCP and send them to web

做~自己de王妃 提交于 2019-12-08 09:46:22
问题 I need to receive data from device connected via Ethernet (modbus/TCP) and send it to webpage (maybe using web sockets). I can't find good examples. Now I can connect with driver and print values using ModbusClientProtocol.read_input_registers() but I had to create own factory and protocol class. I am using autobahn, twisted, pymodbus. 回答1: I've no familiarity with modbus or pymodbus, so I'm guessing and leaving a lot of blanks for you to fill in. This is hacked out of something I recently

Getting dependencies to load correctly in requirejs (autobahn and whenjs)

柔情痞子 提交于 2019-12-08 05:06:15
问题 I have been stuck on this problem for the past few hours. I'm trying to get autobahnjs and whenjs to be loaded correctly by requirejs. require.config({ paths: { angular: '../bower_components/angular/angular', angularBootstrap: '../bower_components/angular-bootstrap/ui-bootstrap', bootstrap: '../bower_components/bootstrap/dist/js/bootstrap', jquery: '../bower_components/jquery/jquery', chosen: '../bower_components/chosen/chosen.jquery.min', text: '../bower_components/requirejs-text/text',

Integrate Autobahn|Python with aiohttp

半世苍凉 提交于 2019-12-08 02:49:37
问题 I'm trying to integrate an aiohttp web server into a Crossbar+Autobahn system architecture. More in detail, when the aiohttp server receive a certain API call, it has to publish a message to a Crossbar router. I've seen this example on the official repos but i've no clue on how to integrate it on my application. Ideally, i would like to be able to do this # class SampleTaskController(object): async def handle_get_request(self, request: web.Request) -> web.Response: self.publisher.publish('com

Override Autobahn/Twisted WebsocketClientProtocol class

試著忘記壹切 提交于 2019-12-08 02:43:42
问题 I want to override my WebSocketClientFactory class to allow a job queue to be filled by the incoming data. Here's the connection code I am trying factory = WebSocketClientFactory("ws://localhost:7096") job_queue = Queue.Queue() factory.protocol = BridgeSocket(job_queue) connectWS(factory) And here's my socket class: class BridgeSocket(WebSocketClientProtocol): def __init__(self,producer_queue): self.producer_queue = producer_queue def sendHello(self): self.sendMessage("hello") def onOpen(self

How to set logging level in twisted?

…衆ロ難τιáo~ 提交于 2019-12-08 01:26:50
问题 I am using autobahn package with twisted which shows debug message for me every connect to websocket. I tried to switch logging level to info but had no success: import logging logging.basicConfig(level=logging.INFO) Is there an easy way to switch log level? Updated. Here is the twisted_service.py: from twisted.application import service from twisted.logger import Logger import logging logging.basicConfig(level=logging.INFO) class WebsocketService(service.Service): log = Logger() def

Combining implementation of autobahn websockets, gstreamers and html5 mediaSource API

落花浮王杯 提交于 2019-12-06 08:24:09
I am running a websocket server using autobahn|python. on the server side, I also have a gstreamer pipeline running which I am using to capture webm frames using "appsink". The gstreamer pipeline that is implemented is: gst-launch-1.0 v4l2src ! video/x-raw,width=640,height=480 ! videoconvert ! vp8enc ! webmmux ! appsink name="sink" Everytime, I receive a buffer in the appsink, I send it over a websocket as a binary "message" using sendMessage. def on_new_buffer(appsink): global once gstsample = appsink.emit('pull-sample') gstbuffer = gstsample.get_buffer() frame_data = gstbuffer.extract_dup(0