C
C#7mo ago
Alex

✅ SignalR client to client communication (chat)

Is it correct that I can't send messages from client to client directly using SignalR? Do I need to send http POST request to endpoint, then inside endpoint I get IHubContext and execute method ReceiveChatMessage? (Client code)

const onSubmit = (
values: SubmitMessageSchema,
reset: UseFormReset<SubmitMessageSchema>
) => {
// METHOD USERNAME MESSAGE
connection?.send("ReceiveChatMessage", "Alex", values.text);
reset();
};

const onSubmit = (
values: SubmitMessageSchema,
reset: UseFormReset<SubmitMessageSchema>
) => {
// METHOD USERNAME MESSAGE
connection?.send("ReceiveChatMessage", "Alex", values.text);
reset();
};
2 Replies
Pobiega
Pobiega7mo ago
signalR and websockets in general are strictly server<->client so yes, you'll need to recieve the message on the server, then send something to the other client
Alex
AlexOP7mo ago
okay, thank you
Want results from more Discord servers?
Add your server