You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
put_markdown(t("## PyWebIO chat room\nWelcome to the chat room, you can chat with all the people currently online. You can open this page in multiple tabs of your browser to simulate a multi-user environment. This application uses less than 90 lines of code, the source code is [here](https://github.com/wang0618/PyWebIO/blob/dev/demos/chat_room.py)", "## PyWebIO聊天室\n欢迎来到聊天室,你可以和当前所有在线的人聊天。你可以在浏览器的多个标签页中打开本页面来测试聊天效果。本应用使用不到90行代码实现,源代码[链接](https://github.com/wang0618/PyWebIO/blob/dev/demos/chat_room.py)"))
nickname=awaitinput(t("Your nickname", "请输入你的昵称"), required=True, validate=lambdan: t('This name is already been used', '昵称已被使用') ifninonline_usersorn=='📢'elseNone)
50
47
51
48
online_users.add(nickname)
52
49
chat_msgs.append(('📢', '`%s` joins the room. %s users currently online'% (nickname, len(online_users))))
53
-
msg_box.append(put_markdown('`📢`: `%s` join the room. %s users currently online'% (nickname, len(online_users)), sanitize=True))
50
+
put_markdown('`📢`: `%s` join the room. %s users currently online'% (nickname, len(online_users)), sanitize=True, scope='msg-box')
54
51
55
52
@defer_call
56
53
defon_close():
57
54
online_users.remove(nickname)
58
55
chat_msgs.append(('📢', '`%s` leaves the room. %s users currently online'% (nickname, len(online_users))))
0 commit comments