ThingWorx Edge Java SDK > Developing Your First Client Application
Developing Your First Client Application
The steps below provide a general summary of the steps to create a client application and links to the details available in this document. For complete information about the interfaces, classes, and methods of the Java SDK, refer to the Javadoc provided in the SDK bundle.
1. Create a class that extends the VirtualThing class. It is possible to create multiple VirtualThing classes and use many at a time. An instance of the VirtualThing class is a representation of a Thing in the Java SDK that has properties, services, and events. It is the building block for interacting with the ThingWorx Platform. For more details, refer to the Javadoc and to the following topics:
2. Create an instance of the ClientConfigurator class. The ClientConfigurator class provides the parameters required to communicate with the ThingWorx Platform over WebSockets.
For example code, refer to Connecting an Application to the ThingWorx Platform. For more details, refer to ClientConfigurator Component, ConnectedThingClient Component, and the Javadoc that comes with the Edge Java SDK.
3. Add properties, services, and events to the extended VirtualThing class above. Use one of the following ways to add them:
Use annotations. It is preferable to use annotations for well-known properties, services, and events that do not change.
Using Methods to Change Property Values. It is preferable to use methods for areas where annotation/attribute is not supported or for properties, services, and events that do change frequently.
For more information, refer to the following topics:
Refer to:
4. Set the Uri for the server, and set up authentication. The first series of examples, Connecting an Application to the ThingWorx Platform, shows how to set the URI for the server. For details on passing secrets such as application keys or proxy server passwords to your applications at runtime, refer tPassword Callbacks.
5. Optionally set the ReconnectInterval and Name properties of the ClientConfigurator instance created in Step 3. Refer to the Javadoc for details on these properties.
6. Create an instance of the ConnectedThingClient class, passing in the instance of the ClientConfigurator created above. The ConnectedThingClient facilitates communication to the ThingWorx Platform, as well as manages any contained VirtualThing. For a simple example, refer to the topic, Connecting an Application to the ThingWorx Platform. For more information about the ConnectedThingClient, refer to the topic, ConnectedThingClient Component and the Javadoc for this SDK.
7. Create an instance of the extended VirtualThing class created in Step 1. For more information, refer to VirtualThing Component.
8. To bind the subscribed properties, services, and events with the ThingWorx Platform, execute the bindThing method of the ConnectedThingClient, passing in the VirtualThing instance. For a simple example, refer to Working with Things. For more details, refer to the topic, Binding to the ThingWorx Platform, and the Javadoc.
9. To start message processing and connection monitoring tasks, execute the start method of the ConnectedThingClient. For a simple example, refer to the topic, Connecting an Application to the ThingWorx Platform.
10. To implement the details of your specific project, write your custom code. The client may be long running, in which case some sort of loop to handle processing would be necessary. The client may connect, do something, and then disconnect. It depends on the specific requirements of your solution.
11. Execute the shutdown() method to stop the client from processing.
* 
As of v.6.1.0 of the Edge Java SDK, WebSocket compression is enabled by default for ALL WebSocket communications, including file transfers and pushing property values to ThingWorx. For more information refer to Compression.
Was this helpful?