Publisher: event state publication (RFC 3903, PUBLISH) - #979
Open
neutrino38 wants to merge 1 commit into
Open
neutrino38 wants to merge 1 commit into
neutrino38 wants to merge 1 commit into
Conversation
JsSIP can SUBSCRIBE to an event package and NOTIFY one, but cannot PUBLISH its own state to a presence server (or any RFC 3903 state agent). Applications had to build the request on SIPMessage and RequestSender internals. `ua.publish(target, eventName, contentType, options)` returns a Publisher, modelled on Subscriber: - publish(body): the initial publication, or a modification. The SIP-ETag of each 2xx names the publication from then on. - Refresh before expiry, with no body and SIP-If-Match, scheduled as Subscriber does to survive Chrome's intensive timer throttling. - terminate(): removal, Expires: 0 and SIP-If-Match; nothing is sent if nothing was published. - At most one PUBLISH in flight: a body given meanwhile is sent when the answer comes back, so the entity-tag always names the last accepted publication. - 412 (the server lost the entity-tag: restart, or expiry while the page was frozen): published again from scratch, once. - 423: published again with the Min-Expires given. - Any other failure terminates the Publisher; `terminated` carries the code and the final response, so that 489/405/501 (no PUBLISH here) can be told from a passing failure. - One Call-ID and an increasing CSeq for all requests, as for REGISTER. - UA.stop() removes every publication before closing, so that watchers do not see a stale state until it expires. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
JsSIP can SUBSCRIBE to an event package and NOTIFY one, but it cannot PUBLISH its own state (RFC 3903) to a presence server. Today an application has to build the PUBLISH request on the
SIPMessageandRequestSenderinternals and handle the entity-tag cycle itself.What
ua.publish(target, eventName, contentType, options)returns aPublisher, built likeSubscriber:SIP-ETag, and later requests send it back inSIP-If-Match. Before expiry, the publication is refreshed with no body. The refresh is scheduled the same way as inSubscriber.terminate()sends nothing if nothing was published.Min-Expires. Any other failure terminates the Publisher.terminatedcarries the response, so that 489, 405 or 501 can be told apart.Registratordoes for REGISTER.UA.stop()removes every publication before the un-REGISTER, so that watchers don't see a stale state until it expires.Typings are in
Publisher.d.tsandUA.d.ts, andC.PUBLISHis added.