消息通知服务 SMN-HTTP(S)消息格式:HTTP(S)推送消息的格式

时间:2025-02-12 15:00:30

HTTP(S)推送消息的格式

HTTP(S)订阅终端订阅确认后,终端将收到 SMN 推送的消息,下面将描述HTTP Content信息,它是JSON串,具体字段说明如表3所示。

表3 HTTP(S)推送消息的格式参数说明

参数

说明

type

消息类型,Notification。

signature

签名信息。

签名字段包括message,message_id,subject, timestamp,topic_urn和type,具体签名信息校验,如果subject不存在,则不参与校验,请参见校验消息签名

subject

消息标题。

topic_urn

主题的唯一标识,表示消息归属的主题。

message_id

消息唯一标识。

signature_version

签名的版本信息,目前是V1。

message

订阅推送消息的描述。

unsubscribe_url

通过访问该链接可以取消终端订阅。

signing_cert_url

用于消息签名的证书URL。

timestamp

消息第一次发送的时间戳。

HTTP(S)推送消息样例如下:
{    "signature": "WmSQ2/0kp2v2u2T33lMqKYrrLxnJoW2NHqIy5QowDuHH3y+HvhCNlCgHDUiAGpb3suCXJm16hWF+EJAYR+tPaTY1q0N3p0p+oBbhlD30fOTxRNsEWRAg73k4qArmQajhdDZOtd57xelQiNhzl2r6iCs0en4kR2iY78zZM/9caZQGBTlNcjkd2lyXYP6aSc7MOgxTsYrRus0A6yipD3zsUA7TvTdfsauAe2hZLR5W0l+um+S3ytT7sA1CMlIJPBXHP5WlqS4iMAeivmufZv7T+G43DbwWfw/seKnK6uFKWd214oqsY2/oLY3C4dcyLdvsy0/7/W8zvxXbgHeSL4******",    "subject": "SMN",    "topic_urn": "urn:smn:region01:0a419ac94f80f2c62f14c01e34******:test_******",    "message_id": "d84bd6629ef04513ad2e37bffd6e17cb",    "signature_version": "v1",    "type": "Notification",    "message": "{\"enterpriseProjectId\": \"0\", \"eventTime\": \"2019-08-12 22:40:55.040632\", \"chargingMode\": \"postPaid\", \"cloudserviceType\": \"xxx.service.type.bandwidth\", \"eventType\": 1, \"regionId\": \"region01\", \"tenantId\": \"057eefe55400d2742f8cc00178******\", \"resourceType\": \"xxx.resource.type.bandwidth\", \"resourceSpecCode\": \"19_bgp\", \"resourceSize\": 10, \"resourceId\": \"e091f1b1-08ef-4e2b-a27e-f85e4c******\", \"resouceSizeMeasureId\": 15, \"resourceName\": \"elbauto_2019_08_13_06_40_46\"}",    "unsubscribe_url": "https://console.******.com/smn/subscription/unsubscribe?region=region01&region_id=region01&subscription_urn=urn:smn:region01:0a419ac94f80f2c62f14c01e34******:test_******:23cf104593284665a1f98691b1******",    "signing_cert_url": "https://smn.region01.******.com/smn/SMN_region01_3190c26a56fb435f9882e3435b******.pem",    "timestamp": "2024-07-10T09:45:00Z"}
support.huaweicloud.com/usermanual-smn/smn_ug_a9002.html