Browse Source

Events mode

jl777
jl777 7 years ago
parent
commit
7ef2b0415e
  1. 5
      iguana/exchanges/LP_commands.c
  2. 18
      iguana/exchanges/mm.c

5
iguana/exchanges/LP_commands.c

@ -233,7 +233,7 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\
}
else if ( strcmp(method,"getendpoint") == 0 )
{
int32_t err;
int32_t err,mode;
retjson = cJSON_CreateObject();
if ( IPC_ENDPOINT >= 0 )
{
@ -250,6 +250,9 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\
jaddstr(retjson,"result","success");
jaddstr(retjson,"endpoint","ws://127.0.0.1:5555");
jaddnum(retjson,"socket",IPC_ENDPOINT);
mode = NN_WS_MSG_TYPE_TEXT;
err = nn_setsockopt(IPC_ENDPOINT,NN_SOL_SOCKET,NN_WS_MSG_TYPE,&mode,sizeof(mode));
jaddnum(retjson,"sockopt",err);
}
else
{

18
iguana/exchanges/mm.c

@ -180,6 +180,24 @@ int main(int argc, const char * argv[])
}
exit(0);
}
else if ( argv[1] != 0 && strcmp(argv[1],"events") == 0 )
{
int32_t len; void *ptr;
if ( (IPC_ENDPOINT= nn_socket(AF_SP,NN_PAIR)) >= 0 )
{
if ( nn_connect(IPC_ENDPOINT,"ws://127.0.0.1:5555") >= 0 )
{
while ( 1 )
{
if ( (len= nn_recv(IPC_ENDPOINT,&ptr,NN_MSG,0)) > 0 )
{
printf("nn_recv[%d] (%s)\n",len,(char *)ptr);
nn_freemsg(ptr);
}
}
}
}
}
else if ( argv[1] != 0 && strcmp(argv[1],"hush") == 0 )
{
uint32_t timestamp; char str[65],wifstr[128]; bits256 privkey; int32_t i;

Loading…
Cancel
Save