Giter Club home page Giter Club logo

Comments (5)

vi avatar vi commented on June 25, 2024

You should probably use --base64 together with --binary-prefix. That would enable you to both send and receive binary messages in otherwise text stream. If you type a line starting with B:, it is interpreted as base64 to be decoded and sent as a binary WebSocket message. If incoming WebSocket message is binary then it would be base64-encoded and B: prepended.

a hex representation too

Currently it is not implemented.

is there a way to hook input and output conversion functions where the binary in/out conversion is handled by somthing of my choice?

You can, for example, use base64 everywhere (i.e. --base64 --base64-text --binary-prefix='B:' --text-prefix='T:') and use custom script that would re-encode things to/from base64 from/to hex.

-k ... wss://domain.tld

Usage of --insecure with real domains (not just internal or localhost ports) is not recommended outside of some quick tests. If you use self-signed certificates, you can specify certificate of your CA as SSL_CERT_FILE environment variable.

from websocat.

alien999999999 avatar alien999999999 commented on June 25, 2024

You should probably use --base64 together with --binary-prefix. That would enable you to both send and receive binary messages in otherwise text stream. If you type a line starting with B:, it is interpreted as base64 to be decoded and sent as a binary WebSocket message. If incoming WebSocket message is binary then it would be base64-encoded and B: prepended.

atm, I've made a simple python script that popen's this one, and i'm doing the base64 with binary prefix in order to handle this, and it starts to work well, and I noticed that my text mode commands fail, and now i understand why;

It seems that the newline is also passed on, eg: i'm trying a websocket server command device list which is 11 bytes long, but 12 bytes is sent (i'm assuming the newline is also sent), which fails with the command comparison functions in the websocket server. is there a way to not send the newline from the input to the websocket?

a hex representation too

Currently it is not implemented.

is there a way to hook input and output conversion functions where the binary in/out conversion is handled by somthing of my choice?

You can, for example, use base64 everywhere (i.e. --base64 --base64-text --binary-prefix='B:' --text-prefix='T:') and use custom script that would re-encode things to/from base64 from/to hex.

-k ... wss://domain.tld

Usage of --insecure with real domains (not just internal or localhost ports) is not recommended outside of some quick tests. If you use self-signed certificates, you can specify certificate of your CA as SSL_CERT_FILE environment variable.

this is for internal use only, and I have a wildcard signed by a cacert (which is selfsigned), but not all of my machines have the cacert CA installed...

from websocat.

vi avatar vi commented on June 25, 2024

11 bytes long, but 12 bytes is sent (i'm assuming the newline is also sent)

You may want to use --binary mode, --no-fixups to avoid automatic insertion of overlays and adding msg2line: / line2msg: overlays manually.

from websocat.

vi avatar vi commented on June 25, 2024

not send the newline from the input to the websocket

--base64-text is supposed to enable base64 for text messages, so you can control whitespace in them precisely.

from websocat.

alien999999999 avatar alien999999999 commented on June 25, 2024

i ended up using --linemode-strip-newlines in the --text mode with --base64 and --binary-prefix B: , that seemed to work

from websocat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.