Skip to content

Conversation

@scholer
Copy link

@scholer scholer commented Oct 4, 2015

Hi,
I have created a module, websocket_client.py, that uses websocket to communicate with the Gephi graph-streaming server.
Would you be interested in merging this into your main repository?
And thanks for creating this nice python module :)
---Rasmus

@panisson
Copy link
Owner

panisson commented Oct 7, 2015

Thanks a lot Rasmus for your contribution, I will merge your pull request to the repository.

Before that, could you confirm this?
It depends on the python package websocket-client: https://github.com/liris/websocket-client
The package can also be installed through pip install websocket-client

I've tested the implementation with the examples, and in order to change the client to use websockets, you need to import websocket_client, create a GephiWsClient and use a ws:// url:

from pygephi import websocket_client

g = websocket_client.GephiWsClient('ws://localhost:8080/workspace0', autoflush=True)

@scholer
Copy link
Author

scholer commented Oct 9, 2015

Hi André,
Thank you for you response - and please let me know if you want me to clean up anything before the merge. Note that in my branch I also removed the import check for json and fallback to simplejson. It is my understanding that this is only relevant for Python 2.5. If you want/need to maintain Python 2.5 support, I can add the import check and fallback back in.

Yes, you are correct on all accounts, both regarding the websocket-client package and using ws:// as the url scheme. This is the default for the sub-class, so the client can be used as:

from pygephi.websocket_client import GephiWsClient
g = GephiWsClient(autoflush=True)

Regarding the websocket-client package, it should be easy to use any of the common python websocket packages - e.g. autobahn, ws4py, websockets or websocket-client. These provide different features and uses different frameworks for e.g. async io, so in theory a user could have a good reason to pick another websocket package than websocket-client. I didn't want to add that choice now, since it will only add code that may not ever be used by anyone. But if you ever get a user request for support for another websocket package, feel free to ping me and I will happily contribute to the implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants