Skip to content

Instantly share code, notes, and snippets.

@kapil1024
Created December 18, 2021 08:39
Show Gist options
  • Select an option

  • Save kapil1024/439597f96e81fb80d45a4acba5759bbe to your computer and use it in GitHub Desktop.

Select an option

Save kapil1024/439597f96e81fb80d45a4acba5759bbe to your computer and use it in GitHub Desktop.
Using websockify (C language) as a websocket to TCP bridge

Project URL https://github.com/novnc/websockify-other

Building websockify

  • apt install openssl-dev
  • git clone [email protected]:novnc/websockify-other.git websockify
  • cd websockify/c
  • make
  • cp websockify /usr/bin

Use

  1. Run a service (say netcat/nc) which listen at some TCP port (say 12345)
    • nc -l -p 12345
  2. Run websockify to listen at some websocket port (say 8080)
    • /usr/bin/websockify -D 8080 localhost:12345
  3. Connect using some websocket client (say browser with JS)

Integrate websockify in your yocto project

Use below sample recipe file websockify_git.bb

SUMMARY = "Assorted ports of websockify code to other languages. websockify is a websocket to TCP bridge."
S = "${WORKDIR}/git/c"
SRC_URI = "git://[email protected]/novnc/websockify-other.git"
SRCREV = "37f42ce95c2949ae8c62379f4f2601c458bb0ddd"
LICENSE = "LGPLv3.0"
LIC_FILES_CHKSUM = "file://../COPYING;md5=e6a600fd5e1d9cbde2d983680233ad02"
FILES_${PN} += "${bindir}/websockify"
DEPENDS += "openssl"
RDEPENDS_${PN} += "libcrypto libssl"
do_install_append() {
install -d ${D}${bindir}
install -m 0755 websockify ${D}${bindir}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment