You want to provide a persistent service over a network, one which maintains an on-going connection with a client.
Create a bi-directional TCP server.
Accessed by the Bi-Directional Client:
The bulk of the work lies in the @socket.on ‘data’@ handler, which processes all of the input from the client. A real server would likely pass the data onto another function to process it and generate any responses so that the original handler.
See also the Bi-Directional Client, Basic Client, and Basic Server recipes.
- Add support for choosing the target domain and port based on command-line arguments or on a configuration file.