Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
React Native Stream Group Chat Tutorial: Send message
// server/server.js
app.get("/send-message", async (req, res) => {
const user_id = req.query.user_id;
const sample_channel = server_side_client.channel('messaging', 'sample-room1', {
created_by_id: user_id,
});
const create_message = await sample_channel.create();
console.log('create message: ', create_message);
const text = 'Hello world!';
const message = {
text,
user_id,
}
const send_message = await sample_channel.sendMessage(message);
console.log('send message: ', send_message);
res.send('ok');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.