Skip to content

Commit

Permalink
Feature/Add_Heartbeat<0>_request
Browse files Browse the repository at this point in the history
  • Loading branch information
Haiss2 committed Aug 20, 2024
1 parent c76ef6c commit 21c500f
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,22 @@ func (c *Client) OnLogout(quickfix.SessionID) {

// ToAdmin notification of admin message being sent to target.
func (c *Client) ToAdmin(msg *quickfix.Message, _ quickfix.SessionID) {
rawData := GetLogonRawData(c.privateKey, c.senderCompID, c.targetCompID, SendingTimeNow())

msg.Body.Set(field.NewRawDataLength(len(rawData)))
msg.Body.Set(field.NewRawData(rawData))
msg.Body.Set(field.NewUsername(c.apiKey))
msg.Body.Set(field.NewResetSeqNumFlag(true))
msg.Body.SetInt(tagMessageHandling, int(c.options.messageHandling))
msg.Body.SetInt(tagResponseMode, int(c.options.responseMode))
msgType, err := msg.MsgType()
if err != nil {
c.l.Errorw("Failed to get msg type", "err", err)
return
}

c.l.Infow("ToAdmin message type", "data", msgType)
if enum.MsgType(msgType) == enum.MsgType_LOGON {
rawData := GetLogonRawData(c.privateKey, c.senderCompID, c.targetCompID, SendingTimeNow())
msg.Body.Set(field.NewRawDataLength(len(rawData)))
msg.Body.Set(field.NewRawData(rawData))
msg.Body.Set(field.NewUsername(c.apiKey))
msg.Body.Set(field.NewResetSeqNumFlag(true))
msg.Body.SetInt(tagMessageHandling, int(c.options.messageHandling))
msg.Body.SetInt(tagResponseMode, int(c.options.responseMode))
}
}

// ToApp notification of app message being sent to target.
Expand Down

0 comments on commit 21c500f

Please sign in to comment.