Can I use websocket for textroom?

I tried to implement textroom via websocket as below.

websocket = new WebSocket('ws://myserver:8188', 'janus-protocol');
websocket.onopen = function(e) {
    websocket.send(JSON.stringify({"textroom" : "list",});
};

But I got below error message.

{
   "janus": "error",
   "error": {
      "code": 456,
      "reason": "Missing mandatory element (transaction)"
   }
}

so I added transaction and tried again

    websocket.send(JSON.stringify({
        "textroom" : "list",
        "transaction" : "1234567890ab"
    });

And I got below error message.

{
   "janus": "error",
   "error": {
      "code": 456,
      "reason": "Missing mandatory element (janus)"
   }
}

I have used “janus” element when I create videoroom via websocket.

Can I use websocket to implement textroom for text chatting?

You are using the Janus API to communicate with a plugin, so the request needs to look like this:

{
	"janus": "message_plugin",
	"transaction": "4321",
	"plugin": "janus.plugin.textroom",
	"request": {
		"request": "list",
		"transaction": "1234"
	}
}

Thank you for your response. and I got below error message.

{
   "janus": "error",
   "transaction": "4321",
   "error": {
      "code": 457,
      "reason": "Unhandled request 'message_plugin' at this path"
   }
}

Actually, I would like to use this textroom feature in non-javascript environment so can’t use like janus.js.

Do I have to use both Restful API and websocket to use it in non-javascript env?

It would be very appreciated If you offer me some samples of steps for it.

You may want to study the Janus API before writing code: RESTful, WebSockets, RabbitMQ, MQTT, Nanomsg and UnixSockets API