You can - a consumer can create and/or modify messages. However, then it’s the consumer doing that, and not the end user.
When an end user sends a message through the websocket to the consumer, that user’s consumer receives the message in the WebsocketConsumer.receive method. That method can then do whatever you want it to do to that message.
As far as having the consumer create messages, “something” needs to trigger that to occur - that event (whatever it needs to be) would need to be handled by that consumer to generate the message.