|
|
# Connecting to the Api
|
|
|
|
|
|
Signal Api lives on `http://localhost:16034/` when the program is running.
|
|
|
|
|
|
# Signal Api Endpoints
|
|
|
|
|
|
## GET: /
|
|
|
|
|
|
Pinging the default / will return a pong message if the Signal Api is active.
|
|
|
|
|
|
Request Example
|
|
|
|
|
|
```
|
|
|
GET: http://localhost:16034/
|
|
|
```
|
|
|
|
|
|
Response Example
|
|
|
|
|
|
```
|
|
|
Status: 200 OK
|
|
|
SignalApi Active
|
|
|
```
|
|
|
|
|
|
## GET: canvas/event
|
|
|
|
|
|
This endpoint will send an event to the currently active canvas effect via `onCanvasApiEvent(event)`
|
|
|
| Parameter | Type | Example | Description |
|
|
|
|-----------|------|---------|-------------|
|
|
|
| sender | String | "Chrome" | This is the sender that gets passed as part of the event |
|
|
|
| event | String | "Victory Flash" | This is the event name given to the canvas effect |
|
|
|
|
|
|
Request Example
|
|
|
|
|
|
```
|
|
|
GET: http://localhost:16034/canvas/event?sender=Chome&event=Victory Flash
|
|
|
```
|
|
|
|
|
|
Response Example
|
|
|
|
|
|
```
|
|
|
Status: 200 OK
|
|
|
```
|
|
|
|
|
|
## onCanvasApiEvent(event)
|
|
|
|
|
|
This is an optional Callback function you can add into a light script to capture SignalApi Canvas Events
|
|
|
|
|
|
The event argument passed from the API is a sanitized JSON object
|
|
|
| Argument | Type | Example | Description |
|
|
|
|----------|------|---------|-------------|
|
|
|
| sender | string | "Chrome" | |
|
|
|
| event | string | "Victory Flash" | |
|
|
|
|
|
|
<div>
|
|
|
|
|
|
```
|
|
|
function onCanvasApiEvent(event) {
|
|
|
|
|
|
console.log(JSON.stringify(event)) //prints {"event":"Victory Flash","":"Chrome"}
|
|
|
|
|
|
}
|
|
|
```
|
|
|
|
|
|
</div> |
|
|
\ No newline at end of file |