CollabVM 1.2 Protocol Reference: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
(7 intermediate revisions by the same user not shown)
Possible statuses:
 
<table class="wikitable">
'''1''': The connection was successful and the client is now connected to the VM.
<tr><th>Value</th><th>Status</th></tr>
 
'''<tr><td>0''': </td><td>The connection failed. This is usually due to an invalid VM ID but depending on the server implementation and protocol extensions could mean something else.
</td></tr>
'''<tr><td>1''': </td><td>The connection was successful and the client is now connected to the VM.</td></tr>
</table>
 
After successfully connecting to a VM, the client will begin to recieve messages as normal, and may send messages.
 
== Client-to-Server Opcodes ==
 
These opcodes may be sent by the client at any time after the handshake to perform various actions
 
=== Account Login ===
 
Used to log in with a CollabVM account. This should only be sent if the server announced authentication using the <code>auth</code> opcode during the handshake phase. Sending this opcode otherwise is undefined behavior.
 
==== Request ====
 
<table class="wikitable">
<tr><td>Opcode</td><td><code>login</code></td></tr>
<tr><td>Parameter 1</td><td>A session token OR bot token obtained from the authentication server announced during handshake.</td></tr>
</table>
 
==== Response ====
 
<table class="wikitable">
<tr><td>Opcode</td><td><code>login</code></td></tr>
<tr><td>Parameter 1</td><td>Login status. <code>0</code> for error, <code>1</code> for success.</td></tr>
<tr><td>Parameter 2</td><td>Human-readable error. Only sent if status was <code>0</code></td></tr>
</table>
 
After a successful login, the client should expect to be renamed and have their rank updated by the server.
 
=== Rename ===
 
Used to change the client's username. This opcode is not available on servers that use account authentication, and the server will respond with an error.
 
==== Request ====
 
<table class="wikitable">
<tr><td>Opcode</td><td><code>rename</code></td></tr>
<tr><td>Parameter 1</td><td>The username requested by the client. If omitted, the server will reassign a guest username.</td></tr>
</table>
 
==== Response ====
 
The server will respond with a [[#Client Renamed|Client Renamed]] event.
 
=== Send Chat ===
 
Send a public chat message to the server.
 
<table class="wikitable">
<tr><td>Opcode</td><td><code>chat</code></td></tr>
<tr><td>Parameter 1</td><td>Chat message to send</td></tr>
</table>
 
=== Take turn ===
 
Request a turn on the VM.
 
<table class="wikitable">
<tr><td>Opcode</td><td><code>turn</code></td></tr>
<tr><td>Parameter 1</td><td><code>1</code> to take a turn, <code>0</code> to cancel your turn. If not specified, the server will infer <code>1</code>.</td></tr>
</table>
 
=== Mouse Instruction ===
 
Send a mouse update to the VM. Only effective if the client has the turn or is an Admin. This opcode has no response.
 
<table class="wikitable">
<tr><td>Opcode</td><td><code>mouse</code></td></tr>
<tr><td>Parameter 1</td><td>X position of the mouse pointer on the VM screen</td></tr>
<tr><td>Parameter 2</td><td>Y position of the mouse pointer on the VM screen</td></tr>
<tr><td>Parameter 3</td><td>Bitmask of mouse buttons being held. See [https://github.com/rfbproto/rfbproto/blob/master/rfbproto.rst#pointerevent Remote Framebuffer Protocol§PointerEvent]</td></tr>
</table>
 
=== Keyboard Instruction ===
 
Send a keyboard update to the VM. Only effective if the client has the turn or is an Admin. This opcode has no response.
 
<table class="wikitable">
<tr><td>Opcode</td><td><code>key</code></td></tr>
<tr><td>Parameter 1</td><td>Key symbol for the key being pressed as a base-10 integer. See [https://cgit.freedesktop.org/xorg/proto/x11proto/tree/keysymdef.h keysymdef.h] for a list (values are in hex and must be converted to base 10)</td></tr>
<tr><td>Parameter 2</td><td><code>1</code> to press the key, <code>0</code> to release.</td></tr>
</table>
 
=== Vote-for-reset ===
 
Vote for or against resetting the VM to snapshot.
 
<table class="wikitable">
<tr><td>Opcode</td><td><code>vote</code></td></tr>
<tr><td>Parameter 1</td><td><code>1</code> to vote in favor of a reset, <code>0</code> to vote against a reset. If there is no active vote, <code>1</code> is used to start one, while <code>0</code> has no effect.</td></tr>
</table>
 
== Admin Opcodes ==
 
These opcodes may be sent to perform administration actions on the VM.
 
TODO
 
== Rank ==
 
CollabVM has four ranks:

Navigation menu