autobahn

Reading Messages on Poloniex Trollbox with Python autbahn or other socket module?

我是研究僧i 提交于 2019-12-01 21:27:52
Poloniex doesn't return every message to my socket. I read the messages with the following code and sometimes I get continuous message numbers, but sometimes there are like 10 messages missing: from autobahn.asyncio.wamp import ApplicationSession from autobahn.asyncio.wamp import ApplicationRunner from asyncio import coroutine class PoloniexComponent(ApplicationSession): def onConnect(self): self.join(self.config.realm) @coroutine def onJoin(self, details): def onTrollbox(*args): print("type: ", args[0]) print("message_number: ", args[1]) print("user_name: ", args[2]) print("message: ", args[3

Trial unittests using Autobahn WebSocket

爷,独闯天下 提交于 2019-12-01 09:15:11
I'm trying to write unittests for my application that uses Autobahn. I want to test my controllers which gets received data from protocol, parses it and reacts to it. But when my test comes to a point when protocol should be disconnected ( self.sendClose ) then it raises error exceptions.AttributeError: 'MyProtocol' object has no attribute 'state'. I was trying to makeConnection using proto_helpers.StringTransport but then I have errors too exceptions.AttributeError: StringTransport instance has no attribute 'setTcpNoDelay'` I'm using trial and I don't want to run dummy server/client for

Running several ApplicationSessions non-blockingly using autbahn.asyncio.wamp

不打扰是莪最后的温柔 提交于 2019-12-01 05:37:06
问题 I'm trying to run two autobahn.asyncio.wamp.ApplicationSession s in python at the same time. Previously, I did this using a modification of the autobahn library as suggested in this post's answer. I now require a bit more professional solution. After googling about for a while, this post appeared quite promising, but uses the twisted library, instead of asyncio . I wasn't able to identify a similar solution for the asyncio branch of the autobahn library, since it doesn't appear to be using

How to send Autobahn/Twisted WAMP message from outside of protocol?

浪尽此生 提交于 2019-12-01 05:22:21
I am following the basic wamp pubsub examples in the github code : This example publishes messages from within the class: class Component(ApplicationSession): """ An application component that publishes an event every second. """ def __init__(self, realm = "realm1"): ApplicationSession.__init__(self) self._realm = realm def onConnect(self): self.join(self._realm) @inlineCallbacks def onJoin(self, details): counter = 0 while True: self.publish('com.myapp.topic1', counter) counter += 1 yield sleep(1) I want to create a reference so that I can publish messages over this connection from elsewhere

Connecting to Poloniex Push-API

爱⌒轻易说出口 提交于 2019-11-30 15:38:50
问题 I want to connect to the Push API of Poloniex. On their page they write the following: In order to use the push API, connect to wss://api.poloniex.com and subscribe to the desired feed. wss = WebSocket Secure -> SSL Protected They also give an example for Node.js and Autobahn|JS: var autobahn = require('autobahn'); var wsuri = "wss://api.poloniex.com"; var connection = new autobahn.Connection({ url: wsuri, realm: "realm1" }); connection.onopen = function (session) { function marketEvent (args

Connecting to Poloniex Push-API

我是研究僧i 提交于 2019-11-30 15:25:20
I want to connect to the Push API of Poloniex . On their page they write the following: In order to use the push API, connect to wss://api.poloniex.com and subscribe to the desired feed. wss = WebSocket Secure -> SSL Protected They also give an example for Node.js and Autobahn|JS: var autobahn = require('autobahn'); var wsuri = "wss://api.poloniex.com"; var connection = new autobahn.Connection({ url: wsuri, realm: "realm1" }); connection.onopen = function (session) { function marketEvent (args,kwargs) { console.log(args); } function tickerEvent (args,kwargs) { console.log(args); } function

sendMessage from outside in autobahn running in separate thread

*爱你&永不变心* 提交于 2019-11-30 07:32:03
问题 I want to call sendMessage method from outside of MyServerProtocol class and send a message to connected clients. I use threading to do this. When I use this code : from autobahn.twisted.websocket import WebSocketServerProtocol, WebSocketServerFactory from twisted.internet import reactor import threading class MyServerProtocol(WebSocketServerProtocol): def onConnect(self, request): print("Client connecting: {0}".format(request.peer)) def onOpen(self): print("WebSocket connection open.") def