This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

BIM ioT
#8
(11.05.2021, 07:08)admin Wrote: 1. Install 2021 RC1 firmware.
2. Create a user library named websocket using the attached source.
3. Upload certificates via FTP using ftp login, rename files with long names to cert.pem and key.pem accordingly.
4. Create a resident script with 0 sleep time.
Code:
if not client then
  require('json')
  ws = require('websocket')
  url = 'wss://test-hub.usbim.com'

  client, err = ws.client('sync', 1)

  opts = {
    protocol = 'tlsv13',
    key = '/home/ftp/key.pem',
    password = [[*q&'wrKQsx+#bj8pbEV=%7Gpr"S+sxV2ngr`N}SjCC`X#rtt!wY6PL`d2'3!^x}u]],
    certificate = '/home/ftp/cert.pem',
    cafile = '/home/ftp/ca-chain.cert.pem',
  }

  res, err = client:connect(url, opts)
  if not res then
    log('connection failed', err)
    client:sock_close()
    client = nil
  end
end

if client then
  frame, opcode, clean, code, reason = client:receive()
  log(frame, opcode, clean, code, reason)
  if frame then
    data = json.pcdecode(frame)
    log(data)
  elseif reason ~= 'timeout' then
    log('connection dropped', reason)
    client:sock_close()
    client = nil
  end
end

This example is only a starting point, it should be extended with additional send/receive logic.

Thank you very much.... now I am getting that log.... I guess something is still wrong...

Attached Files Thumbnail(s)
   
Reply


Messages In This Thread
BIM ioT - by gdimaria - 06.05.2021, 15:05
RE: BIM ioT - by admin - 06.05.2021, 15:08
RE: BIM ioT - by gdimaria - 07.05.2021, 07:54
RE: BIM ioT - by gdimaria - 06.05.2021, 15:11
RE: BIM ioT - by admin - 07.05.2021, 07:59
RE: BIM ioT - by gdimaria - 10.05.2021, 16:16
RE: BIM ioT - by admin - 11.05.2021, 07:08
RE: BIM ioT - by gdimaria - 11.05.2021, 09:30
RE: BIM ioT - by admin - 11.05.2021, 09:32
RE: BIM ioT - by gdimaria - 11.05.2021, 09:41
RE: BIM ioT - by admin - 11.05.2021, 09:42
RE: BIM ioT - by gdimaria - 11.05.2021, 10:24
RE: BIM ioT - by admin - 13.05.2021, 06:23
RE: BIM ioT - by gdimaria - 13.05.2021, 09:05
RE: BIM ioT - by admin - 13.05.2021, 09:06
RE: BIM ioT - by gdimaria - 13.05.2021, 09:51
RE: BIM ioT - by admin - 13.05.2021, 09:53
RE: BIM ioT - by gdimaria - 13.05.2021, 10:01
RE: BIM ioT - by gdimaria - 28.05.2021, 11:07
RE: BIM ioT - by admin - 28.05.2021, 13:57
RE: BIM ioT - by gdimaria - 06.06.2021, 16:35
RE: BIM ioT - by admin - 07.06.2021, 09:59
RE: BIM ioT - by gdimaria - 09.06.2021, 15:17
RE: BIM ioT - by admin - 10.06.2021, 06:05
RE: BIM ioT - by gdimaria - 10.06.2021, 07:48
RE: BIM ioT - by admin - 10.06.2021, 07:53
RE: BIM ioT - by gdimaria - 10.06.2021, 08:26
RE: BIM ioT - by gdimaria - 10.06.2021, 09:27
RE: BIM ioT - by admin - 10.06.2021, 10:03
RE: BIM ioT - by gdimaria - 10.06.2021, 17:34

Forum Jump: