-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Wire API
Mark Nadal edited this page Dec 22, 2015
·
2 revisions
-
HTTP POST
peer
graph
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"soul": {
"_": {"#": "soul", ">": {"field": 1, "hello": 1}},
"field": "value",
"hello": "world!"
}
}' \
https://gunjs.herokuapp.com/gun
{ok: 1}
or
{err: "Persistence layer failed"}
- WS
// paste this into your browser console
var ws = new WebSocket('wss://gunjs.herokuapp.com/gun');
ws.onopen = function(o){
console.log('open', o);
ws.send(JSON.stringify({
"headers": {"ws-rid": "id"},
"body": {
"soul": {
"_": {"#": "soul", ">": {"field": 1, "hello": 1}},
"field": "value",
"hello": "world!"
}
}
}));
};
ws.onclose = function(c){ console.log('close', c) };
ws.onmessage = function(m){ console.log('message', m) };
ws.onerror = function(e){ console.log('error', e) };
{headers: {"ws-rid": "id"}, body: {ok: 1}}
or
{headers: {"ws-rid": "id"}, body: {err: "Persistence layer failed"}}
-
HTTP GET
peer/key
curl https://gunjs.herokuapp.com/gun/some/key