API notification push/poll

edited May 2014 in API Vote Up0Vote Down
I have been working on some inventory synchronization software (it will be open-source once complete, tested and user-friendly enough... but it's not there yet).

I'm wondering, what would be the preferred way to obtain notification of new BrickOwl orders?

For polling, the server's current HTTP 1.1 Keep-alive timeout seems to be about 1.2 seconds, so keeping that socket alive is out of the question. The SSL handshake itself (on top of the TCP handshake) is heavy in processing and bandwidth, so it's slightly wasteful to reconnect every minute. Raising the server's Keep-alive timeout is of course not recommended (memory consumption becomes massive with many connections due to the large socket buffers required for ordinary HTTP traffic).

Pushing notifications from the server by connecting to a custom address wouldn't be too user-friendly (requires properly configured routers/firewalls, etc.). That can still work nicely though, if the API allows updating the notification address/port for sellers with non-static IPs.

A good and probably overkill solution might be an independent server process managing many long-lived sockets with tiny 4kb internal buffers by epoll(). Clients would connect and await the "something happened!" messages among the regular ping/pong every few minutes (traffic would be of no interest, so no need for SSL which would eat an extra 100kb per socket). Definitely overkill though.

Okay, I'm rambling... :) What's the preferred long-term solution, looking ahead to future growth and possibly hundreds of sellers desiring notifications?

Comments

  • 3 Comments sorted by Votes Date Added
  • Check for new orders every 15 minutes by polling, you can limit them using a timestamp so it's only recent ones. Fancier pushing stuff is not something I have any experience with so wouldn't want to get involved with that until it was necessary.
  • All right, thank you.

    There's no rush for that particular feature yet, but some pushing mechanism would be a good idea eventually.
  • Any update on this feature. I have the same issue. A push notification for new orders would really help in synchronization without having to do numerous polls. I was actually going to post a new discussion to ask for this API feature, but then I saw this post. Hope we have a chance to use API push soon.
    Thanks Lawrence for the great API and all your efforts.
Sign In or Register to comment.