Ejemplo n.º 1
0
END_TEST

START_TEST (test_cometd_new_handshake_message) {
    long seed = g_instance->conn->msg_id_seed;

    JsonNode* msg = cometd_new_handshake_message(g_instance);
    JsonObject* obj = json_node_get_object(msg);
    int id = json_object_get_int_member(obj, COMETD_MSG_ID_FIELD);

    json_node_free(msg);

    fail_unless(id == 1);
}
Ejemplo n.º 2
0
int	cometd_impl_handshake(const cometd* h, cometd_callback cb)
{
  int code = COMETD_SUCCESS;
  JsonNode* handshake = cometd_new_handshake_message(h);

  code = cometd_impl_send_msg_sync(h, handshake, NULL);

  if (code == COMETD_SUCCESS && !cometd_current_transport(h))
  {
    code = ECOMETD_NO_TRANSPORT;
  }

  json_node_free(handshake);

  return code;
}