[ST EDGE] Websockets hang or timeout

Hello,

I am attempting to develop an edge driver to work with eufy security, specifically the eufy-security-ws project. This project runs a websocket server to communicate with eufy devices.

I have browsed this forums for days looking for anything websockets, one has lead me to the Smartthings edge drivers repo which bose are using an old version of lustre for websockets.

Here is what I have (using latest version of lustre):

local log = require "log"
local ws = require"lustre".WebSocket
local Config = require"lustre".Config
local socket = require "socket"
local CloseCode = require "lustre.frame.close"
local cosock = require "cosock"
-- local json = require "st.json"

local config = Config.default():keep_alive(60)
local sock, err = socket.tcp()
if err then
    log.error(string.format("failed to creating socket: %s", err))
end

sock:settimeout(5)
log.info("Here we go...")
local websocket = ws.client(sock, "/", config)
local success, err = websocket:connect('192.168.1.100', 3000)

if err then
    log.error(string.format("failed to connect websocket: %s", err))
    return false
end

log.info("connected...%s", success)

I then install this to the hub using the smartthings-cli, I then use the “scan nearby devices” and logcat to monitor the output:

I received an error: Socket connect completed timeout

I have confirmed I can connect to the server using postman, I have also downloaded another websocket server for more testing that simply outputs “connected/disconnected”. It never receives connect (I’ll try inspecting the new traffic next).

I have tried:

  • using cosock on socket, the client just hangs at “calling socket.connect”
  • I am using the latest version of lustre, tried the bose version with callbacks
  • confirmed connectivity from another client
  • different server, confirmed working with other clients
  • run lua locally (adjusted imports), it does connect (fails base64 but not chasing that right now)

I am running out of ideas, appreciate any help in this space.

thanks.