#include "os.h"
static int msgCount = 0;
{
printf ( "Received message:\n" );
printf ( "\n" );
msgCount++;
}
void
{
}
int
main ( int argc, char *argv[] )
{
const char *sessionProps[20];
int propIndex = 0;
if ( argc < 5 ) {
printf ( "Usage: HelloWorldWebSub <http://msg_backbone_ip[:port]> <vpn> <client-username> <topic> [web-transport-protocol]\n");
return -1;
}
if ((strncmp(argv[1], "http", 4) != 0) && (strncmp(argv[1], "ws", 2) != 0)){
printf ("%s: support HTTP or WS transport protocols only\n", argv[1]);
printf ( "\t Usage: HelloWorldWebSub <http://msg_backbone_ip[:port]> <vpn> <client-username> <topic> [web-transport-protocol]\n");
return -1;
}
printf (
"solClient_initialize: returnCode %d (expect %d)\n", rc,
SOLCLIENT_OK);
return -1;
}
printf ( "HelloWorldWebSub initializing...\n" );
&context_p, &contextFuncInfo, sizeof ( contextFuncInfo ) );
printf (
"solClient_context_create: returnCode %d (expect %d)\n", rc,
SOLCLIENT_OK);
return -1;
}
propIndex = 0;
sessionProps[propIndex++] = argv[1];
sessionProps[propIndex++] = argv[2];
sessionProps[propIndex++] = argv[3];
if (argc > 5) {
sessionProps[propIndex++] = argv[5];
}
sessionProps[propIndex] = NULL;
context_p,
&session_p, &sessionFuncInfo, sizeof ( sessionFuncInfo ) );
printf (
"solClient_session_create: returnCode %d (expect %d)\n", rc,
SOLCLIENT_OK);
return -1;
}
printf (
"solClient_session_connect: returnCode %d (expect %d)\n", rc,
SOLCLIENT_OK);
return -1;
}
printf ( "Connected.\n" );
argv[4] );
printf (
"solClient_session_topicSubscribeExt: returnCode %d (expect %d)\n", rc,
SOLCLIENT_OK);
return -1;
}
printf ( "Waiting for message......\n" );
fflush ( stdout );
while ( msgCount < 1 ) {
SLEEP ( 1 );
}
printf ( "Exiting.\n" );
argv[4] );
printf (
"solClient_session_topicUnsubscribeExt: returnCode %d (expect %d)\n", rc,
SOLCLIENT_OK);
return -1;
}
return 0;
}