Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/totetmatt/gephi.stream.graph.websocket
https://github.com/totetmatt/gephi.stream.graph.websocket
Last synced: 9 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/totetmatt/gephi.stream.graph.websocket
- Owner: totetmatt
- Created: 2014-06-08T11:41:59.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-06-15T08:48:51.000Z (over 10 years ago)
- Last Synced: 2024-08-02T14:09:37.688Z (3 months ago)
- Language: JavaScript
- Size: 164 KB
- Stars: 11
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Gephi Stream Graph Websocket
=========
This is a simple module that makes link with a gephi instance through the Gephi Streaming Module.Installation
=========
Just download this repo and add *gephi.stream.graph.websocket.js* as a normal javascript libraryHow to use it
=========
1 - Run Gephi
--
Open gephi and start a new project and put some nodes & edges, or open one (a dummy example can be found on the *example* directory)Go to the Streaming module (if you don't have download it with the plug in manager of Gephi) and activate the master by right clicking on it.
2 - Code your page
--
Include the library :
```html
```Instance an object :
```javascript
var stream = new GephiStream("ws://127.0.0.1:8080/workspace0")
```The GephiStream object is a wrapper around web socket that handle the gephi streaming protocol. It will handle the reception of a message from the Gephi instance and will dispatch to the correct callback.
```javascript
//Node actions
stream.node.onadd = function(data) { /* Do something */}
stream.node.onchange = function(data) {/* Do something */}
stream.node.ondelete = function(data) {/* Do something */}//Edge actions
stream.edge.onadd = function(data) {/* Do something */}
stream.edge.onchange = function(data) {/* Do something */}
stream.edge.ondelete = function(data) {/* Do something */}/**
data will contains will looks like:
{"":{"label":"Streaming Node A","size":2,"otherProperty":"othervalue"}[...]}As designed ( https://wiki.gephi.org/index.php/Graph_Streaming ) it should only contains one object id, but nothing actually prevents to have multiple object defined.
*/
```
Finnally connect to the instance
```javascript
stream.connect()
```
If you want to disconnect
```javascript
stream.close()
```Comments
===
Should works on all modern Web browser. Didn't try with Node.js but should works.