func()

in src/datachannel/streaming.go [201:221]


func (dataChannel *DataChannel) FinalizeDataChannelHandshake(log log.T, tokenValue string) (err error) {
	uuid.SwitchFormat(uuid.CleanHyphen)
	uid := uuid.NewV4().String()

	log.Infof("Sending token through data channel %s to acknowledge connection", dataChannel.wsChannel.GetStreamUrl())
	openDataChannelInput := service.OpenDataChannelInput{
		MessageSchemaVersion: aws.String(config.MessageSchemaVersion),
		RequestId:            aws.String(uid),
		TokenValue:           aws.String(tokenValue),
		ClientId:             aws.String(dataChannel.ClientId),
		ClientVersion:        aws.String(version.Version),
	}

	var openDataChannelInputBytes []byte

	if openDataChannelInputBytes, err = json.Marshal(openDataChannelInput); err != nil {
		log.Errorf("Error serializing openDataChannelInput: %s", err)
		return
	}
	return dataChannel.SendMessage(log, openDataChannelInputBytes, websocket.TextMessage)
}