Private feed reaches end of stream (EOF) immediately. Why?

Added by Lars over 5 years ago

I'm using Java and when I'm calling InputStream.read(byte[]) on the newly connected private feed, it returns -1.
That indicates that there is no more data to be received on this stream, which means it can safely be closed without any loss of data.
However, when querying the Socket.isInputShutdown it returns false, meaning it is open. Socket.isClosed is also false, so the Socket is also still open.

Why do I get -1 (meaning end of stream / EOF)? What are you doing (or not doing) on the server side to create this scenario?

In public feed this works perfectly and InputStream.read(byte[]) is blocking until there is data to be read.
I'm using the exact same class (but different instances) to read from the two feeds.

Please advice.


Replies (2)

RE: Private feed reaches end of stream (EOF) immediately. Why? - Added by Lars over 5 years ago

I think I solved it.

Your examples are incorrect!
The following example shows a field "service":"MY_APP".
With this field, I get EOF right away.
Without it, it works as it should.

Flawed example:

========================================================================
Example of requests

{"cmd":"login", "args":{ "session_key":"ABC123", "service":"MY_APP" }}

On page:
https://api.test.nordnet.se/projects/api/wiki/Feed_API_documentation#Private-order-and-trade-feed-Revision-115

========================================================================

See this page instead:
https://api.test.nordnet.se/next/2/api-docs/docs/feeds
(This page doesn't contain any service fields)

RE: Private feed reaches end of stream (EOF) immediately. Why? - Added by Nordnet Simon over 5 years ago

Thanks for reporting the documentation error and glad that you solved it.

When the login to the feeds fails we always disconnect directly and if the login works we just keep the connection up. We probably need to describe this behaviour better in the documentation.

(1-2/2)