When a client connects, the first bytes must be "abx1" or the server will consider the connection invalid and close it. Any following bytes are considered messages.
A message consists of 4 bytes (little endian) for message length followed by the message contents, which are msgpack-encoded objects.
All messages have a t
field in the root object indicating message type (a string), and an i
field for the message id (a string).
Every client message will receive a response from the server.
This must be the first message a client sends upon establishing a connection. Then, the client must wait for the server to respond before continuing.
Additional fields:
api
(str) api hostip
: (str) proxied client IP address (used for rate limiting)co
: an object mapping cookie names to cookie values which will be passed verbatim to the AKSO API. Should be used to send the client’s session cookies.
This must be the first message a client sends upon establishing a connection. Then, the client must wait for the server to respond before continuing.
This establishes the client as an API client. Various login-related methods will most likely break in this mode.
Additional fields:
api
: (str) api hostkey
: (str) api keysec
: (str) api secret
Additional fields:
un
: (str) usernamepw
: (str) password
Additional fields:
co
: (str) totp codese
: (str?) totp secret. Only present if TOTP is being set up.r
: (bool) if true, the user device should be remembered for 60 days
Additional fields:
p
: (str) pathq
: (object) queryc
: (number) seconds to cache this resource for. 0 will not cache. negative numbers will panic.
Additional fields:
p
: (str) pathq
: (object) query
Additional fields:
p
: (str) pathb
: (object|null) bodyq
: (object) queryf
: (object) files- name ↦ object
t
: (str) mime typeb
: (Buffer) file buffer
- name ↦ object
Additional fields:
p
: (str) pathb
: (object|null) bodyq
: (object) queryf
: (object) files- name ↦ object
t
: (str) mime typeb
: (Buffer) file buffer
- name ↦ object
Additional fields:
p
: (str) pathb
: (object|null) bodyq
: (object) query
Additional fields:
p
: (str[]) perms to check
Additional fields:
f
: (str[]) codeholder fields formatted likefield.rw
to check
Additional fields:
f
: (str[]) own codeholder fields formatted likefield.rw
to check
Additional fields:
r
: (str) regexp strings
: (str) test string
Additional fields:
s
: (object[]) array of script objectsfv
: (object) form varse
: (object) expr to evaluate
Additional fields:
r
: (obj) rates as { [currency]: value }fc
: (str) currency to convert from (should be base forr
)tc
: (str) currency to convert tov
: (number) float value
Gracefully closes the connection.
Server responses always have t
set to the string ~
or ~!
.
If the type is ~!
the server encountered an unexpected error. The message will contain a m
field with a human-readable error string.
ACK. Additional fields:
auth
: (bool) if true, there is a user session
Additional fields if auth
is true:
uea
: (str) uea codeid
: (number) user idtotp
: (bool) if true, the user still needs to use TOTPmember
: (bool) if true, the user is an active member
ACK.
Additional fields:
s
: (bool) if true, login succeeded.
Additional fields if s
is true:
uea
: (str) uea codeid
: (number) user idtotp
: (bool) if true, the user still needs to use TOTPmember
: (bool) if true, the user is an active member
Additional fields if s
is false:
nopw
: (bool) if true, the user has no password. If false, the user entered a wrong user/password combination.
Additional fields:
s
: (bool) if true, logging out succeeded. If false, there was no user session.
Additional fields:
s
(bool) if true, login succeeded.
Additional fields if s
is false:
bad
: (bool) if true, the user has already signed in using TOTP, it has already been set up, or the user still needs to set up TOTP first.nosx
: (bool) if true, there is no user session.
Additional fields:
s
(bool) if true, deleting TOTP succeeded.
Additional fields:
k
: (bool) response is okaysc
: (number) status codeh
: (object) response headers (e.g. x-total-items)b
: (any?) response body
Additional fields:
p
: (bool[]) whether the individual permissions are granted; in the same order as the input
Additional fields:
f
: (bool[]) whether the individual codeholder field permissions are granted; in the same order as the input
Additional fields:
f
: (bool[]) whether the individual own codeholder field permissions are granted; in the same order as the input
Additional fields:
m
: (bool) true if the pattern matches
Additional fields:
s
: (bool) successv
: (any) if success, expr valuee
: (string) error if not successful
Returns the AKSO Script currencies
object.
Additional fields:
v
: (num) converted value (float)
ACK.
Tells the client to set user cookies.
Additional fields:
co
: (string[]) a list of set-cookie header values
A protocol error. The server will subsequently close the connection.
Additional fields:
c
: (number) an error codem
: (string) a human readable error string
This is a heartbeat message to keep the socket from timing out during slow operations.
100
: bad magic number101
: insane message length (negative message length or one that is too large)102
: message decode error103
: timed out200
: unknown message type