채팅 연속 입력 전부 전송(짧은 연타 허용 + 보내기 대기열), 사람도 '입력 중' 표시, 오른쪽 위 소리 크기(0~100, 기본 50)
- 서버 방 채팅: 0.5초 고정 간격 대신 토큰 버킷(4줄 연속, 초당 2줄) — 도배는 여전히 막음 - 웹: useChatOutbox(방 채팅·마피아·라이어 게임)로 빠르게 친 줄도 순서대로 전송 - typing 메시지(방 채팅 / 게임 공개 채팅만, 마피아 밤 채널은 보내지 않음), BotActivity에 사람 표시 - VolumeControl: 사이트 머리글·방 막대 오른쪽 위, 설정 페이지에도 슬라이더 - e2e/chat.e2e.ts: 연타 7줄, 입력 중, 소리 크기 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -226,3 +226,43 @@ describe('윷놀이 room rules', () => {
|
||||
expect(st.view.turnSeq).toBe((room.game!.state as any).turnSeq);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Room chat (2026-10-13)', () => {
|
||||
test('a quick burst of lines all goes through; a flood is still stopped', () => {
|
||||
const { room, clock, conn } = harness();
|
||||
const a = conn('A');
|
||||
const b = conn('B');
|
||||
room.join(a, 'player');
|
||||
room.join(b, 'player');
|
||||
for (let i = 0; i < 4; i++) expect(room.chat('A', `줄 ${i}`)).toBeNull();
|
||||
expect(room.chat('A', '도배')).toBe('조금 천천히 보내 주세요.');
|
||||
clock.advance(500);
|
||||
expect(room.chat('A', '0.5초 뒤')).toBeNull();
|
||||
expect(b.msgs.filter((m) => m.t === 'chat').map((m) => (m as { text: string }).text)).toEqual(['줄 0', '줄 1', '줄 2', '줄 3', '0.5초 뒤']);
|
||||
});
|
||||
|
||||
test('"입력 중" reaches the others (not me), repeats within a second are dropped, off always goes', () => {
|
||||
const { room, clock, conn } = harness();
|
||||
const a = conn('A');
|
||||
const b = conn('B');
|
||||
room.join(a, 'player');
|
||||
room.join(b, 'player');
|
||||
const typingOf = (c: { msgs: ServerMessage[] }) => c.msgs.filter((m) => m.t === 'typing');
|
||||
room.typing('A', true, 'room');
|
||||
room.typing('A', true, 'room');
|
||||
expect(typingOf(b)).toEqual([{ t: 'typing', from: 'A', on: true, ch: 'room' }]);
|
||||
expect(typingOf(a)).toHaveLength(0);
|
||||
clock.advance(1000);
|
||||
room.typing('A', true, 'room');
|
||||
room.typing('A', false, 'room');
|
||||
expect(typingOf(b)).toHaveLength(3);
|
||||
// Game chat signal only while a game with its own chat runs (omok has none).
|
||||
room.typing('A', true, 'game');
|
||||
expect(typingOf(b)).toHaveLength(3);
|
||||
// Chat off: nothing.
|
||||
room.configure('A', { chatEnabled: false });
|
||||
clock.advance(1000);
|
||||
room.typing('A', true, 'room');
|
||||
expect(typingOf(b)).toHaveLength(3);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user