2 // Copyright © 2011-2017 Guy M. Allard
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
22 For Stomp 1.0 Headers MUST contain a "message-id" header key.
25 For Stomp 1.1 Headers must contain a "message-id" key and a "subscription"
29 For Stomp 1.2 Headers must contain a unique "id" header key.
31 See the specifications at http://stomp.github.com/ for details.
34 h := stompngo.Headers{stompngo.HK_MESSAGE_ID, "message-id1",
35 "subscription", "d2cbe608b70a54c8e69d951b246999fbc20df694"}
38 // Do something sane ...
42 func (c
*Connection
) Ack(h Headers
) error
{
43 c
.log(ACK
, "start", h
, c
.Protocol())
47 e
:= checkHeaders(h
, c
.Protocol())
53 if _
, ok
:= h
.Contains(HK_ID
); !ok
{
57 if _
, ok
:= h
.Contains(HK_SUBSCRIPTION
); !ok
{
60 if _
, ok
:= h
.Contains(HK_MESSAGE_ID
); !ok
{
64 if _
, ok
:= h
.Contains(HK_MESSAGE_ID
); !ok
{
69 e
= c
.transmitCommon(ACK
, h
) // transmitCommon Clones() the headers
70 c
.log(ACK
, "end", h
, c
.Protocol())