Ok, I figured this out, there's an error in the code. The message creation code should belong in the receive method rather than chat_message. Otherwise the same message is created for each chat participant with the sender always being the recipient. Took me some time to figure this out, hope it helps someone else.
Roman Poroshin
Hey there, thanks for the article! I have one issue with that, why do the messages end up duplicated with different sender IDs: one with the actual sender and the other is with the participant?