A simple WebSocket wrapper for the RabbitHole API
Go to file
2024-06-27 19:36:42 +00:00
config feat: Implemented Device-Health headers 2024-06-15 22:59:29 +02:00
handlers bugfix: no longer causes meetings to restart after ending 2024-06-26 21:45:37 +02:00
interfaces bugfix: resolved incosistency in naming in the message data struct 2024-06-26 21:29:46 +02:00
rabbit feat: Implemented Device-Health headers 2024-06-15 22:59:29 +02:00
.gitignore feat: Docker support 2024-06-06 14:36:05 +02:00
API.md docs: fixed error in docs 2024-06-26 21:30:15 +02:00
build.sh feat: Docker support 2024-06-06 14:36:05 +02:00
dockerfile feat: Docker support 2024-06-06 14:36:05 +02:00
go.mod feat: Implemented Device-Health headers 2024-06-15 22:59:29 +02:00
go.sum feat: Implemented Device-Health headers 2024-06-15 22:59:29 +02:00
main.go feat: Added response type 'long' 2024-06-07 02:16:04 +02:00
README.md docs: add additional setup step 2024-06-15 23:18:04 +02:00
start.sh.example bugfix: incorrect start.sh example script 2024-06-27 19:36:42 +00:00

RabbitServer GO

Simple WebSocket wrapper to communicate with RabbitHole through regular WebSockets

Getting Started

This guide will cover how to build and run the server. If you need docker instructions, please refer to the Docker section.

Begin by copying the build script

cat start.sh.example > start.sh

Then, edit the start.sh file and set the required environment variables.

# Set ENV vars
export APP_VERSION=<App-Version>
export OS_VERSION=<OS-Version>

Before the next step, we should build the project to generate the bin directory

./build.sh

The executable will also look for a key.pub file in the same directory as the executable. This file should contain the public RSA key used to sign the Device-Health messages.

Finally, we can run the start script and the server will start

./start.sh

Docker

You can run the server using Docker. First, build the Docker image:

docker build -t rabbitserver .

Then, run the Docker container:

docker run -p 8080:8080 -e APP_VERSION=<AppVer> -e OS_VERSION=<OSVer> rabbitserver

For a simpler setup, use Docker Compose. Here's an example docker-compose.yml:

version: '3.8'

services:
  rabbitserver:
    image: rabbitserver
    build: .
    ports:
      - "8080:8080"
    environment:
      - APP_VERSION=<AppVer>
      - OS_VERSION=<OSVer>

Replace <AppVer> and <OSVer> with your application and OS versions, respectively.

Finally, run the Docker container with Docker Compose:

docker-compose up

Usage

The server will start on port 8080 by default. You can change this by setting the PORT environment variable.

When a client connects you will not be able to perform anything until you send a logon message. This message should contain the following fields:

{
  "type": "logon",
  "data": {
    "imei": "<IMEI>",
    "accountKey": "<Account-Key>" // The key can be seen when registering the device
  }
}

After sending this message, you will receive a response with the following format:

{
  "type": "logon",
  "data": "success"
}

You can now start sending messages to the server. The server then responds with the same format as the request

{
  "type": "message",
  "data": "<Message>"
}

API

You can find the API documentation in the API.md file.