Server
New in Version 2.0 for Pro users is "Server". Instant Cafe can now respond to Socket calls over TCP/IP. This makes it possible for developers to create Thin Clients to talk with Instant Cafe Server. Thin Clients can include websites, Mac OS X software, Telnet sessions etc.
A Thin Client can connect to Instant Cafe Server by initiating a call with an API Key. Instant Cafe Server will respond with an "Access: Granted" or "Access: Denied" message depending on whether the API Key validates. If access is granted Instant Cafe Server will then inform the client that it is either "Engaged" or "Vacant". This simply means whether a feed is already running or not.
The purpose of Instant Cafe Server is to allow clients to initiate the creation of data feeds. The server can perform any function that can be performed by a user, for example you can define your own feed format, chose your product types, name your feed, choose its location and FTP it as well. This is all done by sending an XML request to Instant Cafe Server that mirrors the structure for an .icf file. If you save a feed format and open the .icf file in a text editor you will see the exact XML structure required to talk with the server apart from two important nodes.
These two nodes are:
* server_api_key
* callback
A callback is just a URL. After a datafeed has been generated Instant Cafe will ping your callback URL. What your callback actually does is entirely up to you. A possible use could be to email somebody that their feed is complete.
Changes to Server in v2.1.0
* Callback now accepts "realtime" as a value * ICF will send each feed line back in realtime across the network. * Note: It does not send the feed header or footer. It assumes you will know that. * Callback now accepts "last_feed" as a value * ICF will send the complete feed across the network. (Pretty damn cool!") * The header response will be "Access: Feed Complete" * Callback now accepts "server" as a value instead of a URL. * ICF will send "Access: Feed Complete" back to the remote host instead of pinging a URL. * Added server functions: * store_id *store_id This will run a feed for your_store_id using the current settings in ICF. * open_icf *open_icf This will open the ICF file and run the feed. * stop *stop This will stop the current feeds * product_types *product_types This will return the merchandise xml for the current synced products. Message capped off with "Access: /Product Types" to identify the end. * last_feed *last_feed This will send the feed contents of the last feed generated. Useful to be called directly after a "Feed Complete" response. Message capped off with "Access: /Last Feed" to identify the end. * Alert System * Incoming connects are now reported via the alert system.
Example Telnet Session from iPhone
Here's an example Telnet session using pTerm on the iPhone (a PuTTY client). Just shows you how easy it is to use the Server functionality to control Instant Cafe.
Example ASP Code
I've written some sample ASP code that illustrates how to connect to Instant Cafe Server via ASP. Easily ported to PHP with PHP Socket. Click here to download a sample.


