How to re-connect the server to receive "Server Sent Event"

Hello. I am a smartthings client programmer.

in my simple console program, I am now trying to receive Server Sent Event from the smartthings clould sever. So, in my program, I tried successfully to connect to the uri “https://api.smartthings.com/subscriptions”. However, but after amount of time, the connection was closed unexpectedly, and failed to re-connect to the server with the following exception message.

Unhandled Exception . System.Net.WebException : no connection could be made because tharget machine actively refused it. destnation target computer reject

does anybody know the reason? why the server refused the connection and how to handle the issue in my program to keep the connection.

Welcome to the SmartThings Community, @junimnjw!

I’m not sure what you’re trying to do but:

  1. Subscriptions only work for installedApp instances. This means you cannot create/query subscriptions without having an installedAppId as part of the request
  2. Subscriptions cannot be created using a Personal Access Token. Only a SmartApp Token or an Access Token from an OAuth integration.

Please, if you want to discuss this further, send an email to build@smartthings.com as we might have to discuss private information.