in src/main/java/com/amazonaws/kvstranscribestreaming/publisher/WebSocketTranscriptionPublisher.java [101:117]
public void publishDone() {
if(getConnectionId() == null) {
logger.info("{} failed to get the connection id ", WEB_SOCKET_PUBLISHER_PREFIX);
return;
}
try {
String endedMsg = String.format("=== Transcription Ended for call %s in stream %s ===", this.detail.getCallId(), this.detail.getStreamArn());
PostToConnectionRequest postRequest = new PostToConnectionRequest().withConnectionId(this.connectionId).withData(StandardCharsets.UTF_8.encode(endedMsg));
PostToConnectionResult postResult = apigatewayClient.postToConnection(postRequest);
logger.info("{} post to connection result is {}", WEB_SOCKET_PUBLISHER_PREFIX, postResult.toString());
} catch (Exception e) {
// Don't have to handle any exception since this is the last POST that is sent to the endpoint.
logger.error("{} publish done encountered exception, error message: {}", WEB_SOCKET_PUBLISHER_PREFIX, e.getMessage(), e);
}
}