MCPcopy Index your code
hub / github.com/codeaashu/claude-code / write

Method write

src/cli/transports/WebSocketTransport.ts:660–681  ·  view source on GitHub ↗
(message: StdoutMessage)

Source from the content-addressed store, hash-verified

658 }
659
660 async write(message: StdoutMessage): Promise<void> {
661 if ('uuid' in message && typeof message.uuid === 'string') {
662 this.messageBuffer.add(message)
663 this.lastSentId = message.uuid
664 }
665
666 const line = jsonStringify(message) + '\n'
667
668 if (this.state !== 'connected') {
669 // Message buffered for replay when connected (if it has a UUID)
670 return
671 }
672
673 const sessionLabel = this.sessionId ? ` session=${this.sessionId}` : ''
674 const detailLabel = this.getControlMessageDetailLabel(message)
675
676 logForDebugging(
677 `WebSocketTransport: Sending message type=${message.type}${sessionLabel}${detailLabel}`,
678 )
679
680 this.sendLine(line)
681 }
682
683 private getControlMessageDetailLabel(message: StdoutMessage): string {
684 if (message.type === 'control_request') {

Callers 1

handleOpenEventMethod · 0.95

Calls 5

sendLineMethod · 0.95
jsonStringifyFunction · 0.85
logForDebuggingFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected