These are chat archives for fanout/pushpin

Aug 2018
Aug 12 2018 00:17
@jkarneges I had today some more time to try things out. As mentioned above, I can now send requests to my server app through CURL and Postman and I get a response back. The problem I did not recognize further is that I am receiving always the same response: OPENTEXT 47 c {"channel":"8bd121dd-4acc-48af-ac7f-580940e74b5e","type":"subscribe"}(the channel changes everytime) I would expect my own object which should contain a JSON token instead of this "subscribe" message. How can I resolve this? Do I need to run Pushpin in the background to solve this problem (I am trying to write some unit tests)?
Justin Karneges
Aug 12 2018 01:59
@picarsite you shouldn't need to run pushpin, just make the same http requests that pushpin would have made
by "expect my own object" do you mean you were expecting different messages to be returned? if so, look at your ws.send() calls and ensure they are being called where you expect
Aug 12 2018 10:14
@jkarneges Yes, I'm expecting a different message as response. In my logs, I can see that my own message is sent back but in reality instead I get the subscribe message back like mentioned here OPEN\r\nTEXT 24\r\nc:{\"channel\":\"1\",\"type\":\"subscribe\"}\r\n
Aug 12 2018 10:43
{"message":"Server is listening on port 8080!","level":"info","timestamp":"2018-08-12T10:42:58.825Z"}
{"message":"Request received.","level":"info","timestamp":"2018-08-12T10:43:02.840Z"}
{"message":"New client connected.","level":"info","timestamp":"2018-08-12T10:43:02.841Z"}
{"message":"Request: \"Login\".","level":"info","timestamp":"2018-08-12T10:43:02.842Z"}
{"message":"Generating AuthToken for client.","level":"info","timestamp":"2018-08-12T10:43:02.843Z"}
{"message":"AuthToken generated and sent to the client.","level":"info","timestamp":"2018-08-12T10:43:02.852Z"}
Aug 12 2018 17:55
I found the problem. Providing the sign function of jsonwebtoken a callback, means that the function is runned asynchronous. Using it without a callback runs the function synchronous and I get my correct message back. This is not a problem when there is Pushpin running in the background and a connection is established between the client and pushpin/server.