• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mochi-mqtt / server
98%
main: 99%

Build:
Build:
LAST BUILD BRANCH: fix/mqtt-qos2-reject-packet-type
DEFAULT BRANCH: main
Repo Added 31 Jul 2023 12:22PM UTC
Token wwuZN5Hbfggtgv5vrR81VZ9SOo4ssZo2R regen
Build 319 Last
Files 30
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

LAST BUILD ON BRANCH StoredClientByID-hook
branch: StoredClientByID-hook
CHANGE BRANCH
x
Reset
Sync Branches
  • StoredClientByID-hook
  • #393
  • badger_crashed_on_server_close
  • badgerdbv4
  • buffer_optimization
  • bugfix/fix-qos-1-delivery-after-server-restart
  • dario-messagexpiry
  • data_race
  • dependabot/go_modules/github.com/golang/glog-1.2.4
  • dependabot/go_modules/golang.org/x/net-0.17.0
  • dependabot/go_modules/golang.org/x/net-0.23.0
  • dependabot/go_modules/golang.org/x/net-0.33.0
  • dependabot/go_modules/golang.org/x/net-0.36.0
  • dependabot/go_modules/golang.org/x/net-0.38.0
  • dependabot/go_modules/google.golang.org/protobuf-1.33.0
  • documentation/add-live-broker
  • expose-stop-time
  • feat/tcp-address-from-listener
  • feature/add-logging-level-config
  • feature/basic-file-config
  • feature/change-to-slog
  • feature/update-server-defaults
  • file-based-config
  • fix-inherit-session
  • fix-readme-example
  • fix/acl/publishToClient
  • fix/mqtt-qos2-reject-packet-type
  • is-taken-over
  • issue_340
  • issue_346
  • issue_364
  • main
  • maintainers/mochi-co/file-based-config
  • master
  • maxclients
  • mochi-co-patch-1
  • mochi-co/inline-subscriptions
  • omitempty
  • pebbledb
  • readme
  • readmejp
  • recommended-minimum-keepalive
  • reconnectkeepsubs
  • refs/tags/2.6.0
  • refs/tags/v.2.7.8
  • refs/tags/v2.3.0
  • refs/tags/v2.4.0
  • refs/tags/v2.4.1
  • refs/tags/v2.4.2
  • refs/tags/v2.4.3
  • refs/tags/v2.4.4
  • refs/tags/v2.4.5
  • refs/tags/v2.4.6
  • refs/tags/v2.6.0
  • refs/tags/v2.6.1
  • refs/tags/v2.6.2
  • refs/tags/v2.6.3
  • refs/tags/v2.6.4
  • refs/tags/v2.6.5
  • refs/tags/v2.6.6
  • refs/tags/v2.6.7
  • refs/tags/v2.7.8
  • refs/tags/v2.7.9
  • remove-vendor-folder
  • retain-message-expiry
  • revert-321-main
  • small-fixes-cleanups
  • update-imports
  • wait-for-all-clients-to-disconnect-before-continuing

10 May 2024 09:33PM UTC coverage: 97.934% (-0.7%) from 98.622%
9038356648

Pull #402

github

snej
Allow a Hook to reload an individual client session

In a clustered environment, client connections are distributed among
multiple Server instances on different machines. After a client
disconnects, leaving behind a persistent session state, its next
login is likely to be on a different node. Because of this, in such a
setup an individual Server instance should only keep Client instances
corresponding to online client connections, and it should be able to
reload an individual client's state (presumably from persistent
storage) when that client connects.

This commit adds support for such an environment by adding a new hook
`StoredClientByID`. An implementation finds and returns any
persistent client data for a given session ID. In practice the only
necessary information turned out to be the saved subscriptions and
in-flight ack messages. The hook also returns the prior 'Remote'
property since the server logs that.

The Server method `inheritClientSession` is extended to call this hook
if there is no matching in-memory Client session. If the hook returns
session data, it installs it into the Client object in the same way
as the existing code.

At the end of the Server method `attachClient`, after disconnection,
the existence of a `StoredClientByID` hook is checked; if present,
the method expires the Client instance so it won't hang around in
memory and so the next connection will go to the hook to reload
state.
Pull Request #402: Allow a Hook to reload an individual client session

24 of 68 new or added lines in 2 files covered. (35.29%)

6163 of 6293 relevant lines covered (97.93%)

60.63 hits per line

Relevant lines Covered
Build:
Build:
6293 RELEVANT LINES 6163 COVERED LINES
60.63 HITS PER LINE
Source Files on StoredClientByID-hook
  • Tree
  • List 30
  • Changed 6
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
9038356648 StoredClientByID-hook Allow a Hook to reload an individual client session In a clustered environment, client connections are distributed among multiple Server instances on different machines. After a client disconnects, leaving behind a persistent session state, its n... Pull #402 12 May 2024 09:27AM UTC snej github
97.93
See All Builds (308)

Badge your Repo: server

We detected this repo isn’t badged! Grab the embed code to the right, add it to your repo to show off your code coverage, and when the badge is live hit the refresh button to remove this message.

Could not find badge in README.

Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

Refresh
  • Settings
  • Repo on GitHub
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc