Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
lesismal committed Feb 6, 2025
1 parent 37c02e7 commit 45ef856
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion examples/webchat/chat.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@
if (!msgInput.value) {
return false;
}
client.notify("/chat/user/say", msgInput.value);
client.call("/chat/user/say", msgInput.value).then(function (resp) {
console.log("say success, resp:", resp.data, resp.err);
}).catch(function (err) {
var item = document.createElement("div");
item.innerText = err;
appendLog(item);
});
msgInput.value = "";
return false;
};
Expand Down
1 change: 1 addition & 0 deletions examples/webchat/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ func NewServer(room *Room) *arpc.Server {
if err == nil {
room.Broadcast(msg)
}
ctx.Write(msg.Message)
}
}
})
Expand Down

0 comments on commit 45ef856

Please sign in to comment.