Skip to content

weapp/sjson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sjson

A library for transfer a Stream of JSONs

Example

Server

import socket
from sjson import SJSON, CMD

port = 9090

print socket.gethostname(), port

server_sjson = SJSON()
(client, address) = server_sjson.bind((socket.gethostname(), port))
client.send({"hello": "world"})
client.send(1j + 1)
client.send(1)
client.send(1.1)
client.send("1")
client.send(["1"])
client.send(None)
client.send(CMD("ACK"))
client.send(CMD("ERROR"))
client.send(CMD("WORKER"))
client.send(CMD("END"))
client.send(CMD("---"))  # == CMD("ERROR")
client.close()

Client

import socket
from sjson import SJSON

port = 9090

print socket.gethostname(), port

client_sjson = SJSON()
client_sjson.connect((socket.gethostname(), port))
for item in client_sjson.recv():
    print repr(item)

About

A library for transfer a Stream of JSONs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages