dukeboard/kevoree-corelibrary — pull request #1 by maxleiko (2013-07-12 08:53:22+00:00)
Title: NewFeature: pull JSON models from BasicGroup & WebSocketGroup

Using control byte 42 BasicGroup & WebSocketGroup will send to client a JSON serialized model.

```java
private final byte getJSONModel = 42;

@Override
public void receive(byte[] data, Connection from) {
try {
if (data == null) {
Log.error("Null rec");
} else {
switch (data[0]) {
// ...
case getJSONModel:
ByteArrayOutputStream baos = new ByteArrayOutputStream();
JSONModelSerializer serializer = new JSONModelSerializer();
serializer.serialize(getModelService().getLastModel(), baos);
from.send(baos.toByteArray(), Delivery.RELIABLE);
break;
// ...
}
}
} catch (Exception e) {
Log.error("Something bad ...", e);
}

}
```