LP#1268619: websockets: initial C libs api_level support
authorBill Erickson <berick@esilibrary.com>
Mon, 3 Mar 2014 21:23:44 +0000 (16:23 -0500)
committerGalen Charlton <gmc@esilibrary.com>
Tue, 19 Aug 2014 22:50:48 +0000 (15:50 -0700)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>

src/libopensrf/osrf_message.c

index 364c875..3681dfa 100644 (file)
@@ -425,6 +425,9 @@ jsonObject* osrfMessageToJSON( const osrfMessage* msg ) {
        if (msg->sender_ingress != NULL) 
                jsonObjectSetKey(json, "ingress", jsonNewObject(msg->sender_ingress));
 
+       if (msg->protocol > 0) 
+               jsonObjectSetKey(json, "api_level", jsonNewNumberObject(msg->protocol));
+
        switch(msg->m_type) {
 
                case CONNECT:
@@ -620,7 +623,7 @@ static osrfMessage* deserialize_one_message( const jsonObject* obj ) {
 
        // Get the protocol, defaulting to zero.
        int protocol = 0;
-       tmp = jsonObjectGetKeyConst( obj, "protocol" );
+       tmp = jsonObjectGetKeyConst( obj, "api_level" );
        if(tmp) {
                const char* proto = jsonObjectGetString(tmp);
                if( proto ) {