Popularity
3.6
Growing
Activity
1.1
Growing
12
1
3
Programming language: Crystal
License: MIT License
Tags:
Network Protocols
crystal-json-socket alternatives and similar shards
Based on the "Network Protocols" category.
Alternatively, view crystal-json-socket alternatives based on common mentions on social networks and blogs.
-
simple_rpc
RPC Server and Client for Crystal. Implements msgpack-rpc protocol. -
crystal-mqtt
Crystal lang implementation of the MQTT protocol, a lightweight protocol for publish/subscribe messaging -
connect-proxy
crystal lang connect / HTTP proxy implementation -
gopher.cr
A fast, extensible, Gopher-protocol server written in Crystal
Static code analysis for 29 languages.
Your projects are multi-language. So is SonarQube analysis. Find Bugs, Vulnerabilities, Security Hotspots, and Code Smells so you can release quality code every time. Get started analyzing your projects today for free.
Promo
www.sonarqube.org
Do you think we are missing an alternative of crystal-json-socket or a related project?
README
crystal json-socket 
JSON-socket client & server implementation. Inspired by and compatible with sebastianseilund/node-json-socket and ruby json-socket
Installation
Add this to your application's shard.yml
:
dependencies:
json-socket:
github: foi/crystal-json-socket
Usage
server.cr
require "json-socket"
struct CustomJSONSocketServer
include JSONSocket::Server
def on_message(message, socket)
puts message
result = (message["a"].as_i + message["b"].as_i) * message["b"].as_i * message["a"].as_i
self.send_end_message({ :result => result}, socket)
end
end
server = CustomJSONSocketServer.new("127.0.0.1", 1234) # OR CustomJSONSocketServer.new(unix_socket: "/tmp/json-socket-server.sock", delimeter: "µ")
server.listen
client.cr
require "json-socket"
to_server = JSONSocket::Client.new(host: "127.0.0.1", port: 1234) # OR JSONSocket::Client.new(unix_socket: "/tmp/json-socket-server.sock", delimeter: "µ")
result = to_server.send({ a: 12, b: 8})
if (result)
puts result
end
client.cr with timeouts in seconds
require "json-socket"
to_server = JSONSocket::Client.new(host: "127.0.0.1", port: 1234, read_timeout: 10, write_timeout: 5) # OR JSONSocket::Client.new(unix_socket: "/tmp/json-socket-server.sock", delimeter: "µ", read_timeout: 10, write_timeout: 5)
result = to_server.send({ a: 12, b: 8})
if (result)
puts result
end