Giter Club home page Giter Club logo

pythonpusherclient's People

Contributors

benruijl avatar ekulyk avatar fly-away avatar fuzeman avatar gravengaard avatar icook avatar mrichardson23 avatar onyxfish avatar tomwilkie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pythonpusherclient's Issues

Error messages started yesterday (no code changes)

I've been using your PythonPusherClient module and as of yesterday it broke for no known reason. None of the code I use has been changed, it just broke.

Connection: Message - {"event":"pusher:error","data":{"code":4005,"message":"Path not found"}}
Connection: Unhandled event
Connection: Error -
Connection: Connection closed
Attempting to connect again in 10 seconds.

Bug with a long run of PusherClient

Here below is the error message :

Unhandled exception in thread started by <bound method Connection.run of <Connection(Thread-1, initial)>>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pusherclient-0.2.0-py2.7.egg/pusherclient/connection.py", line 88, in run
self._connect()
File "/usr/local/lib/python2.7/dist-packages/pusherclient-0.2.0-py2.7.egg/pusherclient/connection.py", line 111, in _connect
self.socket.run_forever()
File "/usr/local/lib/python2.7/dist-packages/websocket/_app.py", line 179, in run_forever
self.sock.close()
File "/usr/local/lib/python2.7/dist-packages/websocket/_core.py", line 810, in close
self._closeInternal()
File "/usr/local/lib/python2.7/dist-packages/websocket/_core.py", line 813, in _closeInternal
self.sock.close()
AttributeError: 'NoneType' object has no attribute 'close'

Thankx to have a look on it,
Arnaud

Add tests!

Adding tests and hooking up something like travis would be really helpful!

State of project?

Hello! We're currently using the dev branch directly to get the secure-option.
Is there a released planned anytime soon so that we can go back to using the real release? =)
Thanks!

Connection Lost, Can't Reconnect

After a few minutes of not receiving data, I see in the console:

Did not receive any data in time. Reconnecting.
Connection: Error - [Errno 35] Resource temporarily unavailable
Connection: Connection closed
Attempting to connect again in 10 seconds.
Connection: Connection opened
Connection: Connection closed
Attempting to connect again in 10 seconds.

The API documentation says: "In protocol versions 5 and above, when using an old version of the WebSocket protocol, Pusher will send pusher:ping event (see events) to the client. The client should respond with a pusher:pong event." I don't see any ping events coming through, though.

PyPi release

Have you considered releasing this package on pypi.python.org?

That would simplify the package installation a lot.

"Pusher protocol versions <= 3 have been deprecated. Support will be removed after November 2013"

Hey @ekulyk, Adam from Pusher here.

We've been contacted by several of our customers as this library supports a version of our protocol that is <= version 3, and we are sending warnings out to customers warning that we are going to be deprecating these versions of the API shortly. We plan to finish deprecating these versions before the New Year.

In order to keep this library usable for you and your users, could you please ensure that the library is upgraded to a later version of the protocol (preferably version 6)? Please contact me directly if you'd like me to assist you in any way with this. :)

hmac errors

Hi there,

when trying to use the lib, hmac is throwing errors because msg in hmac.new() is a string and should be byte or bytearray.

Greets

Allow for user-defined reconnect interval

It is currently impossible to set a user-defined reconnect interval, since the variable self.reconnect_interval is set to the function argument of the reconnect() function every time it is called.

The quickest way to implement this feature is to let the default value of reconnect_interval in the reconnect function point to an instance variable.

Missing ws argument in _on_open callback

I got next errors when I try to use last version of websocket (0.56.0):

error from callback <bound method Connection._on_open of <Connection(Thread-8, started daemon 14424)>>: _on_open() missing 1 required positional argument: 'ws'
error from callback <bound method Connection._on_message of <Connection(Thread-8, started daemon 14424)>>: _on_message() missing 1 required positional argument: 'message'

It works good if I downgrade websocket-client to version 0.48.0.

It seems like according to recent changes of websocket-client, the callback function does not receive WebSocketApp instance if it is a method of any class.

Recent changes of websocket-client

Handling Connection Close

The server I'm connecting to seems to close the connection after some time. I would like to handle this event (re-establishing the connection). From what I can see in the code pusherclient doesn't seem to expose the close handler of websocket-client WebSocketApp. Instead only a log is written and timers stopped via the following code:

    def _on_close(self, ws, *args):
        self.logger.info("Connection: Connection closed")
        self.state = "disconnected"
        self._stop_timers()

Is there a way to handle the connection close with pusherclient without modifying it?

Is this project alive?

I was wondering if this project is still alive.
If not do you know of a replacement project?

Handlers Cannot Terminate Connection

I'm trying to write some code that'll handle a fixed number of events then exit. The natural way to do this seems to be calling Pusher.disconnect() from a handler once it's seen enough events.

But since the callbacks are fired from within Pusher's connection thread and disconnect() ends in a Thread.join(), this results in a RuntimeError.

Example code:

import time
import pusherclient

class MyClient(object):
    
    STOP_AT_N = 5
    
    def __init__(self):
        super(MyClient,self).__init__()
        self.n_events = 0
    
    def connect(self):
        "Connect to a random Pusher channel & consume events"
        self.pusher = pusherclient.Pusher('de504dc5763aeef9ff52')
        def event_handler(e):
            self.n_events += 1
            print("event %d" % (self.n_events,))
            if self.n_events >= self.STOP_AT_N:
                self.pusher.disconnect()
        def connect_handler(data):
            channel = self.pusher.subscribe('live_orders')
            channel.bind('order_created', event_handler)
        self.pusher.connection.bind('pusher:connection_established', connect_handler)
        self.pusher.connect()


if __name__ == '__main__':
    mc = MyClient()
    mc.connect()
    while True:
        time.sleep(1)

What happens for me:

$ python3 experiments/pusher_handler_disconnect.py
event 1
event 2
event 3
event 4
event 5
error from callback <bound method Connection._on_message of <Connection(Thread-1, started daemon 123145422946304)>>: cannot join current thread

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.