Handbook
Glossary
handle-discord-websocket ( obj opcode -- )
Vocabulary
discord
Inputs
obj
an
object
opcode
an
object
Outputs
None
Definition
USING:
byte-arrays
combinators
formatting
io
io.encodings.string
io.encodings.utf8
json
kernel
namespaces
tools.hexdump
;
IN:
discord
:
handle-discord-websocket
( obj opcode -- )
"opcode: "
gwrite
dup
g.
over
dup
byte-array?
[
utf8
decode
json>
]
when
g...
gflush
{
{
f
[
[
"closed with error, code %d"
sprintf
gprint-flush
stopping-discord-bot
]
[
"closed with f"
gprint-flush
]
if*
]
}
{
1
[
[
drop
]
[
utf8
decode
json>
parse-discord-op
]
bi
]
}
{
2
[
[
[
hexdump.
flush
]
with-global
]
when*
]
}
{
8
[
drop
"close received"
gprint-flush
]
}
{
9
[
[
"ping received"
gprint-flush
send-heartbeat
]
when*
]
}
[
2drop
]
}
case
;