B4J Question send and receive binary with websockets

Discussion in 'B4J Questions' started by narek adonts, May 7, 2019.

  1. narek adonts

    narek adonts Well-Known Member Licensed User


    I am making a mesanging application and I decided to make the backend in b4j.

    I was thinking to using mqtt broker as the server but without some events of the broker it is not possible (authorizations,...)

    And I decided to use jServer with websockets. But it seems that in jServer websockets only support support String to send and receive data.

    Is there a way to send/receive bytes instead of string?

  2. BillMeyer

    BillMeyer Well-Known Member Licensed User

  3. OliverA

    OliverA Expert Licensed User

    B4J's jServer WebSocket implementation does not support binary data directly. One way around that would be to Base64 encode the data. Note that jServer has a limit on how much can be transferred at one time via WebSockets (the limit can be changed. See https://www.b4x.com/android/forum/threads/websocket-received-data-exceeds-limit.90678/). You could also use WebSockets for textual communications and regular server handlers for binary transfers (see https://www.b4x.com/android/forum/threads/sending-binary-data-over-websocket.44776/#post-273894).
    narek adonts likes this.
  4. narek adonts

    narek adonts Well-Known Member Licensed User

    Thank u. I know this )) I thought that maybe we could add some Java code to add the functionality
  5. narek adonts

    narek adonts Well-Known Member Licensed User

    The problem is not only authorization. Some backend work like add to database, notification, ... lot of things must be done. ACL file is not a good solution if the ACL file is too large, so if the users increase it will be an issue
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice