Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Q]: Are there any documentation for interfacing SimpleX Chat CLI in websocket mode? #4127

Open
KamikazeRaven opened this issue May 3, 2024 · 1 comment
Labels
question Further information is requested triage

Comments

@KamikazeRaven
Copy link

Question

Hello team,

I am playing with the SimpleX Chat CLI to learn the in and outs of SimpleX Chat and learn how to build a bot. According to this typescript bot document as well as the SimpleX Chat CLI -h output, the SimpleX Chat can be started with the -p argument to make it a websocket server app.

For example:

simplex-chat -p 5225

However, I could not find any additional document on how to interface with SimpleX Chat CLI when it is running as a websocket server app. I am not familiar with typescript nor javascript, I've spent hours reading the typescript bot source code and I still could not understand how it interfaces with the CLI running as websocket server.

I was able to make initial connection with the CLI through websocket using python. Upon initial connection, I receive a long json string detailing the current status of the user and contacts. But that's the last meaningful respond I ever get from the CLI. Any other message send to the CLI websocket server will only return one type of response:

{
    "resp": {
        "type": "chatCmdError",
        "chatError": {
            "type": "error",
            "errorType": {
                "type": "commandError",
                "message": "invalid request"
            }
        }
    }
}

I added indentation for easy reading.

On the command.ts file, starting at line 669, it appears to be a function that translates the function APIs in typescript to SimpleX Chat CLI command. However, if I send a command such as /users to the CLI websocket, I only receive the exact same error response as shown above.

I traced how the typescript code send commands to SimpleX Chat CLI websocket app all the way back to line 125 of this transport.ts file (shown below). It looks like the command was converted into JSON format. But I was not able to find any JOSN template in the source code.

  async write(cmd: ChatSrvRequest): Promise<void> {
    return this.ws.write(JSON.stringify(cmd))
  }
}

Can someone please shine some light into my brain?😄
The document on how to use CLI has no detail neither.

@KamikazeRaven KamikazeRaven added question Further information is requested triage labels May 3, 2024
@KamikazeRaven
Copy link
Author

Hello team. I really want to make some bot tools on SimpleX Chat as it seem to be the most secure app. Could someone please give me any information that can help me interfacing with SimpleX Chat CLI?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested triage
Projects
None yet
Development

No branches or pull requests

1 participant