mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-17 00:24:43 -04:00
fix(communication): send ready event when both sides are ready
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
e6b9afc686
commit
f4a1999a8b
11 changed files with 271 additions and 142 deletions
|
@ -135,7 +135,7 @@ export const EditorPane: React.FC<EditorPaneProps> = ({ scrollState, onScroll, o
|
|||
const mayEdit = useMayEdit()
|
||||
|
||||
useEffect(() => {
|
||||
const listener = messageTransporter.doAsSoonAsConnected(() => messageTransporter.sendReady())
|
||||
const listener = messageTransporter.doAsSoonAsConnected(() => messageTransporter.startSendingOfReadyRequests())
|
||||
return () => {
|
||||
listener.off()
|
||||
}
|
||||
|
|
|
@ -89,9 +89,9 @@ describe('frontend websocket', () => {
|
|||
|
||||
it('can send messages', () => {
|
||||
mockSocket()
|
||||
const value: Message<MessageType> = { type: MessageType.READY }
|
||||
const value: Message<MessageType> = { type: MessageType.READY_REQUEST }
|
||||
adapter.send(value)
|
||||
expect(sendSpy).toHaveBeenCalledWith('{"type":"READY"}')
|
||||
expect(sendSpy).toHaveBeenCalledWith('{"type":"READY_REQUEST"}')
|
||||
})
|
||||
|
||||
it('can read the connection state when open', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue