Process and check create stream command, store transaction id

This commit is contained in:
Muaz Ahmad 2023-08-15 15:55:41 +05:00
parent b0239ed761
commit 9f0cf39b3b

View file

@ -33,6 +33,26 @@ func (amf_obj_root AMFObj) ProcessConnect() (err error) {
return return
} }
func (amf_obj_root AMFObj) ProcessCreateStream(trans_id *float64) (err error) {
err = errors.New("Bad AMF create stream")
if _, ok := amf_obj_root[0]; !ok {
return
} else if command_string, ok := amf_obj_root[0].(string); !ok || command_string != "createStream" {
return
}
if _, ok := amf_obj_root[1]; !ok {
return
}
transac_id_float, ok := amf_obj_root[1].(float64)
if !ok {
return
}
*trans_id = transac_id_float
err = nil
return
}
func EncodeConnectResponse() ([]byte, error) { func EncodeConnectResponse() ([]byte, error) {
amf_root_obj := make(AMFObj) amf_root_obj := make(AMFObj)
amf_root_obj[0] = "_result" amf_root_obj[0] = "_result"