-
Notifications
You must be signed in to change notification settings - Fork 1
Websocket Interface
superernie77 edited this page Feb 19, 2017
·
6 revisions
The space game provides a websocket server interface for plying the game with any client-implementation.
The websocket server listens on the following URL on port 8080:
[url for the stage]:8080/space
At the moment any client can connect to the server without authentication or authorization.
To interact with the game, the server accepts Json objects in the following format:
{"worldId":0,"playerId":0,"worldEventType":"START"}
- worldId: id of the world you want to interact with
- playerId: id of the player you want to interact with
- worldEventType: the requested type of interaction
The following worldEvents are supported:
- START : Starts a game
- STOP : Ends the game
- SPACE : Hero interacts with environment
- DOUBLE_SPACE: Changes the direction of the hero movement
- TRIPPLE_SPACE: Changes the active inventory item
When a world has been started by a start-event for a player, the player's websocket connection will receive a world update every second. The world update includes the updated world-string with the location of the player.