Skip to content

Server OSC Message Protocol

isha edited this page Nov 19, 2014 · 3 revisions

Viper's server is expecting a remote device to follow a format when sending an OSC message.

Sample OSC Message:

    addrpattern: /rime
    typetag: sssssssisfsfsssssi

    [0] deviceId
    [1] qwertyuiop
    [2] method
    [3] create
    [4] image
    [5] snowball.jpg
    [6] id
    [7] 0
    [8] posX
    [9] 0
    [10] posY
    [11] 0
    [12] deviceId
    [13] qwertyuiop
    [14] method
    [15] delete
    [16] id
    [17] 0

Corresponding JSON Message:

   [
    {
        "deviceId": "qwertyuiop",
        "method": "create",
        "image": "snowball.jpg",
        "id": 0,
        "posX": 0,
        "posY": 0
    },
    {
        "deviceId": "qwertyuiop",
        "method": "delete",
        "id": 0
    }
   ]

As seen from the sample OSC message above, all OSC messages' address pattern must be "/rime" in order for Viper to recognize the message as valid.

Each deviceId parameter will signal the start of a new JSON command. For example, since above sample OSC message included 2 deviceId parameters, Viper expects 2 different JSON commands within the message.

In addition, deviceId parameter must match an ID within registeredDevices.txt in order for Viper to recognize the message as valid.

Commands within the OSC message are registered into Viper in the order of received parameters. For example, in the above sample message, create command will register first, then update command will register.