Hi again,
Could you provide us with some guide or example on how to setup the WebSockets configuration on the client and server? I can't seem to get it to work using the examples provided, on the Wiki & the MicroServer ZIP package. I'm not even talking about file transfers or tunneling, just basic connectivity of Things to begin with. For example, in the MicroServer ZIP package, the "etc/config.json.complete" example file contains several syntax errors (comma's missing, quote instead of colon character).
I have a ws_servers, appKey, http_server and auto_bind section, most of them with default values. On the server, I have a client endpoint with URL ws://localhost:8080/Thingworx/WSChannel and the same appKey.
The wsems can't seem to connect to the server:
bcme-dev-twx01:8080-->[INFO ] 2014-07-01 10:55:18,420 wsEmsProxy::initialize: In
itialization complete!
/ERROR 2014-07-01 10:55:19,379 RestThingworx: EMS is not connected
Has anything changed in the EMS REST API? Can the new 5.0 EMS & WebSockets be used without having to change something in our own connectivity .NET code/assembly?
For the configuration on the server: how should that be set up? Can we remain using the existing Things or do we have to create new Things and ThingTemplates on the server for the WebSocket-connected Things?
Thanks,
Stefan
Hi Stefan,
I'm waiting to hear back from development regarding changes to the EMS and how best to migrate from XMPP to WebSocket. In the meantime, you can upload your config.json to your company's File Repository and I'll take a look.
Thanks,
Adam
Ok, thanks. I uploaded the config.json file. I don't know if the autobind settings are correct? I tried with both gateway: true & false.
Regards,
Stefan
Hi Stefan,
Sorry about the delay in my response. I had a chance to look over your config.json file and it appears that you're trying to connect to a server listening on port 8080. By default, the WSEMS will attempt to connect using SSL, so you will need to turn off encryption by adding a "ws_connection" object and "encryption": "none" attribute/value to your config.json (see config.json.complete). For your autobind settings, setting gateway to true will make the WSEMS function like the XMPP
Channels
(basically, providing a gateway for other connections/Things
). When it's false, it will function like aRemote Thing
and you'll need to create a correspondingRemote Thing
on the platform. If you're trying to setup a basic connection, you shouldn't have to modify any of the endpoints (or anything really) on the platform.Based on a conversation with a colleague who is familiar with your application, you'll likely want to simply use the .NET SDK and avoid the WSEMS entirely.
Lastly, to migrate from XMPP to WebSocket you'll need to create new
Thing Templates
andThings
. There is no process for converting your existing XMPP entities to WebSocket entities.Regards,
Adam
Thanks for the reply. I've added the ws_connection object with encryption: "none" to the config.json file. I've created a new ThingTemplate, with base template "RemoteThingWithFileTransfer". The properties were all defined in Thing Shapes, so I could add them to the new Template with no problem.
Now the Thing shows up as connected on the server. But its properties are not yet transferred. luaScriptResource gives an message:
[INFO ] 2014-07-09 11:02:32,437 EdgeThing: Attempting to GetPropertySubscription
s from server failed. code: 500, result: {"dataShape":{"fieldDefinitions":{}},"r
ows":[]}
[WARN ] 2014-07-09 11:03:11,566 thingworx.server: Could not set properties on se
rver. code: 500, resp: {"dataShape":{"fieldDefinitions":{}},"rows":[]}
Using WireShark, I see that the following error message is transmitted:
Entity EdgeThing does not exist or is not yet associated with a Thing.
The thing is, our .NET application uses the REST API to communicate with the Micro Server, not the .NET SDK, because the SDK didn't exist yet when development started. So is the old REST API compatible with the new WebSockets EMS, or do we have to change our code to use the new .NET SDK?
Thanks,
Stefan