Obsolete
/
ipc.cr-old
Archived
3
0
Fork 0

Sending IPC::JSON, simplification for IPC::Client.

cbor
Karchnu 2020-07-23 19:24:30 +02:00
parent 7870346afb
commit bc77e8c056
1 changed files with 12 additions and 0 deletions

View File

@ -29,6 +29,18 @@ class IPC::Context
def send(fd : Int32, message : IPC::JSON)
send fd, message.type.to_u8, message.to_json
end
def send_now(fd : Int32, message : IPC::JSON)
send_now fd, message.type.to_u8, message.to_json
end
end
class IPC::Client
def send(message : IPC::JSON)
send @server_fd.not_nil!, message.type.to_u8, message.to_json
end
def send_now(message : IPC::JSON)
send_now @server_fd.not_nil!, message.type.to_u8, message.to_json
end
end
# CAUTION: Only use this method on an Array(IPC::JSON.class)