WebSocket connection is failing. We built a C# Socket.IO client code and Connect is failing.

  • 1
  • Problem
  • Updated 7 months ago
string ioServer = string.Format("https://stream.automatic.com?token=clientid:clientsecret");
            socket = new Client(ioServer);
socket.Connect();

We get error: Error initializing handshake with https://stream.automatic.com/?token=clientid:clientsecret

Please help. Are we missing anything? We are building a POC and based on this we would go with purchasing few hundred of this product for our internal shuttles and we will build a solution.
Photo of Fleet Developer

Fleet Developer

  • 120 Points 100 badge 2x thumb

Posted 7 months ago

  • 1
Photo of Matt Farley

Matt Farley

  • 1,506 Points 1k badge 2x thumb
Photo of Fleet Developer

Fleet Developer

  • 120 Points 100 badge 2x thumb
Hi Matt,

Thanks for your pointers, they are helpful. We would actually be building a web interface(or a desktop interface) to view the cars in our company and the mileage they drove etc. We will not be linking all cars into one account. The Website would query Automatic.com cloud for the car data and display on a screen that our management could see. If performance is an issue, we may go for the RestAPI which is not real time data(i.e we need to do a pull of the data based on demand). We wanted to use WebSocketAPI OR WebHook for realtime data fetch, but if realtime query causes performance hit we thought we'll use RestAPI calls to fetch data on demand. We have about 9 company shuttles and about 800 company vans and we thought of using Automatic.com Pro device in each one of them after doing this POC.

If someone can help resolving the Socket.IO connection issue that would be great so we can continue with POC and make a decision about performance hit etc.

You think this product would meet our requirement above?(i.e we have a webpage querying all car data and not tying all cars to one account)? Please comment.
Photo of Matt Farley

Matt Farley

  • 1,506 Points 1k badge 2x thumb
On paper, the API should be able to provide you what you need. But whether or not the vendor provides the level of support you need is a different question. As of now, there is little-to-no-support.
Photo of Fleet Developer

Fleet Developer

  • 120 Points 100 badge 2x thumb
Thanks, I was just reading some other messages from you in this site. Do you by any chance have a working code/testerapp that I could use as a sample to build my own connection from my C# code? I got a developer account with a clientid and secret. I used these in the websocket URL as per their documentation but connection fails. Do I need to write the OAuth client code before trying to make Websocketcall? I thought OAuth is only if we call their RestAPI. If authentication using OAuth is needed before the Websocket connection call, curious where I should plugin the access token that OAuth returns me(their websocketURL is taking only clientid:clientsecret and no place to plugin access token)?
Photo of Matt Farley

Matt Farley

  • 1,506 Points 1k badge 2x thumb
I have a solution I shared, but it's in Python, not C#: 

https://community.automatic.com/automatic/topics/sharing-my-websockets-real-time-notification-script

https://pastebin.com/5UM22bSj

Once your server-side is working, it will only show data from clients who have gone through the authorization workflow. i.e. they've signed in with the automatic web portal and authorized your app to access their account. I had to do this for myself before I would see my own cars in my own app. If other people authorized on my app, I'd start seeing their cars too.