A toy asp.net core Websocket API with embedded DBreeze key-value database. This is purely a demo and not nessesarily "full and proper" way to do things, but it does work. The point is to demonstrate desining api's with web-socket, and to demonstrate embedded database Dbreeze.
Get the SimpleWebsocketClient chrome extension. If you are running the server on your local machine, direct it to ws://localhost:80/ws
The server responds to messages, independantly and not nessesarily in order.
{
"Type":"GetAnnotations",
"Id":0
}
{
"Type":"GetAnnotations",
"Id":6,
"Annotations":
[
{"DateTimeUTC":"2016-11-29T14:53:47.1549874Z","Name":"Test","Type":"Test","Description":""},
{"DateTimeUTC":"2016-11-29T14:56:30.0990522Z","Name":"Test","Type":"Test","Description":""}
]
}
{
"Type":"GetDataGroups",
"Id":0
}
{
"Type":"GetDataGroups",
"Id":0,
"DataGroups":[
{"StartDateUTC":"2016-11-29T14:57:28.31141Z","Name":"Test", "Description":"Test"}
]
}
If the datagroup does not exist, it will create a new one. if it does exist, it will update / overwrite. ###Request and reponce
{
"Type":"AddOrUpdateDatagroup",
"Id":0,
"DataGroups":[
{"StartDateUTC":"2016-11-29T14:57:28.31141Z","Name":"Test", "Description":"Test"}
]
}
{
"Type":"AddOrUpdateAnnotations",
"Id":0,
"Annotations":[
...
]
}
Really only the time field is mandatory, but it needsto be exactly correct
{
"Type":"DeleteAnnotations",
"Id":2,
"Annotations":[
{"DateTimeUTC":"2016-11-29T14:53:47.1549874Z","Name":"Test","Type":"Test","Description":""}
]
}
Works same as above