An experimental project to create a general purpose library allowing multiple SNAP sessions to communicate with each other via a central server.
To boot the server using maven, run:
mvn jetty:run
You can boot up the war found on the releases page
In a local webbrowser, load up localhost:8080/snap/snap.html
. Then from inside snap, load up the xml via File->Import
Then load /src/main/snap/collabsnap.xml or /src/main/snap/topography.xml from your project
Optionally, load up the collabsnap xml or topgraphy xml from the releases page.
In the resources folder, you'll find sample projects that show how one might use collabsnap.
Use this block to send a simple ping to the server, which should create some kind of output in the jetty log for now.
Use this block to poll server each second for news of a new message. This will loop over all registered listeners. It should only be used once per snap session.
Use to add a listener to the list of polling listeners. The first argument is a filter as created by collabsnap-filter-*. The second is a block to run with the responding message. Returns an id that can be later used to remove. Duplicate listeners do not get added.
Removes a listener with the id passed in (which should have been returned by collabsnap-add-listener)
Removes all listeners.
When used in collaboration with a listener that has a sprite message, argument is created as a new sprite.
When used in collaboration with a listener that has a sprite message, argument is created as a clone.
Filter method which, when used with collabsnap-poll-server, sends a filter to only return sprites with a variables named name equal to value
Filter method which, when used with collabsnap-poll-server, sends a filter to only return messages with the key key
Use this block to get the xml serialization of the passed in sprite, useful with "my[self]" sense block.
Use this block to send object to the server. Most useful with collabsnap-serialize-sprite or messages.
Use this block to send the current sprite to the server.
Returns a GUID for this running instance of snap. This will then be retained and returned for every further call while the page is still open.
Returns the key portion of message
Returns the value portion of message
Returns a message made up of key and value for message passing.
Returns the stage width in pixels.
Returns the stage height in pixels.
Converts a pixel location in x to a unit location.
Converts a unit location to a stage location in x.
Converts a pixel location in y to a unit location.
Converts a unit location to a stage location in y.
Gets the current sprites unit x position
Gets the current sprites unit y position