Closed geniqtech closed 12 months ago
Applicable to all users, it is necessary to ensure that at and user information have been obtained.
https://github.com/coolkit-carl/ewelink-api-next/blob/main/test/WSSControlDemo.ts
It is a relatively complete example that you can modify to use.
Tried referencing the example code but if I try to set at using: at: wsClient.at => the log file will print empty value for at.
If I try to manually set using: at: 'xxxxx' => the value of at will be printed in log file however it still does not work.
onMessage() event does not fire at all.
Can I also confirm that userApiKey is the same as appSecret?
Read through the guide/references again. It seems that for Web Socket Server, we will need to use userApiKey that is not the same as appSecret.
I'm using OAuth 2.0 method via free API. Where can I get this userApiKey?
@coolkit-carl Can't figure out what was your response in previous post. Can you kindly enlighten?
@coolkit-carl Can't figure out what was your response in previous post. Can you kindly enlighten?
Ok got it but would be clearer if the documentation stated this clearly in the first place. Also would be nice if this User API Key is shown on the developer portal.
Will the Web Socket Server work for Free account user? Tested using the sample code but onMessage event does not trigger when I turn my device on and off. Also I noticed that the connection automatically cuts off after a few minutes.
[2023-09-04T14:45:52.642] [INFO] as - WebSocket connection has been established [2023-09-04T14:45:52.642] [INFO] as - Send userOnline message: {"action":"userOnline","at":"","apikey":"","appid":"xxx","nonce":"yyy","userAgent":"app","sequence":"1693809952642"} [2023-09-04T14:48:32.651] [INFO] as - WebSocket connection has been closed