hharnisc / python-meteor

A meteor client for python
MIT License
157 stars 27 forks source link

'Could not subscribe because a connection has not been established' #11

Closed dylanreich closed 9 years ago

dylanreich commented 9 years ago

Hi, excited to use this package - I was using python-ddp, but wanted to do mongodb inserts and switched to this. However, where client.connect() and client.call() worked with python-ddp, I get this error with python-meteor when calling any method after connect: raise MeteorClientException('Could not subscribe because a connection has not been established')

My code: client = MeteorClient('ws://urlimusing.com/websocket') client.connect()

Thanks!

dylanreich commented 9 years ago

Update: I tried creating a new project and running example.py, but I received the same error. Is something broken? Here's the whole log: Last login: Mon Dec 15 14:41:57 on ttys002 dylans-mbp:~ dylanreich$ python example.py Traceback (most recent call last): File "example.py", line 44, in client.subscribe('lists') File "/Library/Python/2.7/site-packages/MeteorClient.py", line 162, in subscribe self._wait_for_connect() File "/Library/Python/2.7/site-packages/MeteorClient.py", line 317, in _wait_for_connect raise MeteorClientException('Could not subscribe because a connection has not been established') MeteorClient.MeteorClientException: Could not subscribe because a connection has not been established

fpaboim commented 9 years ago

This seems to be a new bug, I downgraded to 0.1.2 and that fixed it.

dylanreich commented 9 years ago

I tried 0.1.2, but got the same error. Have you tried connecting to an app living on meteor.com? 0.1.1 did it for me (obviously there's no auto-reconnect, not too sure if that will affect me at the moment though). Thanks for helping btw. EDIT: My mistake, I ended up with the erorr (on 0.1.1): MeteorClient.MeteorClientException: Could not subscribe because a connection has not been established

feeloo007 commented 9 years ago

Hello, I have same issue if python-ddp version is in 0.1.2. No issue if python-ddp version is 0.1.1.

Perhaps version must be included in setup.py.

dylanreich commented 9 years ago

Hey @feeloo007 , did mean python-meteor instead of python-ddp?

fpaboim commented 9 years ago

Sorry, forgot to mention i also forced pip to downgrade python-ddp to version 0.1.2, did you try that?

feeloo007 commented 9 years ago

Hello @dylanreich, @fpaboim,

python-ddp is a python-meteor dependancy (you can see it in setup.py).

I don't tried to connect an app living in meteor.com, only in LAN. Perhaps you have a firewall issue. If your network use proxy, you can set proxy via http_proxy variables.

In my network I use something like :

'http_proxy=http://res-pxserver.apps.paris.mdp:8080 https_proxy=http://res-pxserver.apps.paris.mdp:8080 no_proxy='127.*, *.mdp, 10.*, 192.168.*' python main.py

Concerning modules versions, It seems that :

I have made a Pull Request to add python-ddp version in setup.py.

Best regards

ppettit commented 9 years ago

hi @dylanreich, @fpaboim and @dylanreich,

i've done a bunch of fixes over the last few days that i think might have got this sorted out (and #10).

could you try my post_0.1.3_fixes branch of python-ddp and my post_0.1.3_fixes branch of python-meteor and see it they solve your issues?

i think this is better than reverting to an old version of python-ddp - let me know if it works!

thanks,

paul.

feeloo007 commented 9 years ago

Hi @ppettit,

I'm on vacation until Tuesday 20.

I can not make a return before then.

thanks,

Philippe

feeloo007 commented 9 years ago

Hi @ppettit,

Sorry for the delay.

Apparently, I have no more the issue 'Could not subscribe because a connection has not been established' using post_0.1.3_fixes branch of python-ddp and post_0.1.3_fixes branch of python-meteor.

Currently I have strange behavior but is certainly due tovery large collection or a nearly full filesystem on mongodb.

I subscribe to 2 collections. A little and a very big one.

While 'subscribed' event on big one has not been emited, updates on little one seems to be delayed (using synchronous or asynchronous (callback setted ) updates).

When 'subscribed' event is emited on big collection, a flood of callback on update are emitted.

But patches concerning 'Could not subscribe because a connection has not been established' seems to be ok.

thank you for your help @ppettit

ppettit commented 9 years ago

hi @feeloo007,

thanks for trying those patches. i'm glad the original problem seems to be fixed. we have been using them in production for a while too.

my app only has 1 document from one collection published to the python part (though it is updated a lot) so i haven't seen the other issue you describe with multiple collections. If i get a chance i'll take a look at it. hopefully @hharnisc will get a chance to look at my pull requests too.

thanks,

paul.

hharnisc commented 9 years ago

I've merged in @ppettit (huge thank you!) changes and published them. To update the package run pip install -U python-meteor this should update both python-meteor and python-ddp to version 0.1.4