The first-party social plugin (plugins/social, providerType: social, plugin API 1.3) adds friends to Poker Engine: friend requests, blocks, privacy settings, presence (who is online and at which table, with a link to join), table invites and chip gifting between friends.
It has no pages of its own for players: everything sits in the product’s own pages (the player’s profile, the public player profile, Settings, the cashier and the admin users list).
It’s sold separately as social-<version>.tgz; Poker Engine releases don’t include it. Install it with Upload plugin on Extensions › Plugins, which shows the consent dialog (see Installing the First-Party Plugins).
For operators
What players see
| Where | What |
|---|---|
Header (layout.main.header.end) | A Friends button with the number of friends online and a badge for new requests. It opens the friends drawer: Add friend (username search), Requests (accept or decline), Online (with the table and a Join, Watch or View button) and Offline (last seen). On phones (below 640px) the button sits at the top of the menu drawer. |
Lobby (lobby.sidebar) | Friends playing now, with join buttons. Hidden for players without friends. |
Table seat (table.seat.badge) | A star on friends’ seats. Clicking another player’s badge offers Add friend (or Accept) and Block. |
Own profile, Friends tab (profile.tabs, own profile only) | /profile?tab=plugin:friends, with the sections Friends (search to add, the list with invite, gift, remove and block), Requests (received and sent), Blocked and Gifts (received and sent; with free daily gifts on, a Free daily gifts card first: the inbox with Collect all and a Send button per friend). §ion=requests (blocked, gifts) opens a section directly. The section buttons wrap on a phone. The drawer’s Manage friends and the lobby’s All friends open this tab. |
Public profile /players/<username> (profile.actions, profile.header.badges) | Under the header: Add friend (or Not accepting friend requests), Accept / Decline, Cancel request, Gift, Invite to my table (while you are seated), Remove friend, Block / Unblock, and, for a friend at a table, where they play with a Join button. Beside a friend’s name: a Playing now badge. Both follow the friend’s privacy settings (nothing while they appear offline or hide their table). Nothing shows on your own profile or when signed out. |
Settings, Friends & privacy (settings.sections) | /settings#social-privacy: the player settings. |
| Settings, Notifications | The core grid lists Social with Friend requests, Table invites and Gifts, each with In-app and Push switches. |
Cashier, Transfer (cashier.transfer.recipient) | Or pick a friend under the recipient field fills in a friend’s username. The transfer itself is the core real-money transfer. |
| Usernames | In the drawer, the lobby panel, the Friends tab, search results and gift history, usernames link to the public profile /players/<username>. |
| Gift dialog | Preset amounts, a balance type selector (Real money only appears when real gifting is on), an optional message and a confirmation step. Amounts show the language’s thousands separators (1,000). |
| Toasts | Live toasts for friend requests, accepted requests and gifts. Table invites show a toast with a Join (or Watch / View) button on every page, the table included. |
| Notifications | In-app and push for friend requests, table invites and gifts, and in-app when a request is accepted, each in its category so players can switch it off in Settings. |
Old links. The plugin’s pages of plugin API 1.2 redirect: /ext/social/ (and /ext/social/?tab=...) to /profile?tab=plugin:friends, /ext/social/u/<username> to /players/<username>. Links in notifications already sent keep working.
Join links. A friend at a public cash table with a free seat gets Join (/table/<id>); a full cash table (or a club table) gets Watch (/tables/<id>/watch); a tournament gets View (/tournament/<id>); a private table shows "Playing a private game" with no link and no table name.
Player settings
Each player sets these in Settings → Friends & privacy (/settings#social-privacy; the Friends tab links there):
| Setting | Effect |
|---|---|
| Appear offline | Friends see the player as offline, without tables or last-seen time. |
| Hide my table | Friends see the player online but not where they play. |
| Friend requests | Anyone (default) or Nobody. |
| Gifts | Friends (default) or Nobody. |
Blocks
Blocking a player removes any friendship or pending request between the two and stops requests, gifts and invites both ways. A blocked player can’t find the blocker in search, and the blocker’s profile looks like a missing player to them. The blocker sees the block in the Blocked section of the Friends tab and can lift it there or on the player’s public profile.
Settings
Every setting is optional; an empty value uses the default.
| Setting | Default | Meaning |
|---|---|---|
maxFriends | 200 | Accepted friends per player (1 to 500). A player at the limit can’t send or accept requests. Pending requests are limited to 100 sent per player. |
virtualGiftsEnabled | on | Friends may send each other play chips. |
realGiftsEnabled | off | Friends may send each other real money. See Real-money gifts. |
virtualGiftPresets | 100, 500, 1000, 5000 | One-tap amounts in the gift dialog (at most 8; values outside the min/max are dropped). |
realGiftPresets | 1, 5, 10, 25 | Same for real money. |
virtualGiftMin / virtualGiftMax | 10 / 100,000 | Smallest and largest play-chip gift. Play-chip gifts are whole chips. |
realGiftMin / realGiftMax | 1 / 100 | Smallest and largest real-money gift (up to 2 decimals). |
virtualDailySendLimit / virtualDailyReceiveLimit | 100,000 / 200,000 | Play chips a player may gift / receive per UTC day. 0 means no plugin limit. |
realDailySendLimit / realDailyReceiveLimit | 200 / 500 | Same for real money. The cashier transfer limits apply on top. |
giftMinAccountAgeDays | 7 | The sender’s account must be at least this old. |
giftMinHandsPlayed | 50 | The sender must have played at least this many hands (the engine’s player statistics). |
giftMinFriendshipHours | 24 | The two players must have been friends at least this long. |
giftCooldownMinutes | 10 | Minimum time between two gifts from the same sender to the same friend. 0 turns it off. |
dailyGiftsEnabled | off | Free daily gifts (1.1.0): each friend can be sent a free gift of play chips every UTC day. It is not taken from the sender: the plugin credits it (wallet:credit-virtual) when the friend collects it from the inbox. These credits count against the plugin’s virtual-credit daily cap (Plugins > Social > Wallet daily caps). |
dailyGiftAmount | 10,000 | Chips in one free gift (1 to 10,000,000). The amount is fixed when the gift is sent. |
dailyGiftPerFriendLimit | 1 | Free gifts a player may send the same friend per UTC day (1 to 10). |
dailyGiftInboxMax | 50 | Free gifts that can wait in a player’s inbox; a full inbox refuses new ones (1 to 200). |
dailyGiftExpiryDays | 7 | Days a free gift waits before it expires uncollected (1 to 90). |
inviteRewardEnabled | off | Invite reward (1.1.0): when a player who signed up with a referral link reaches inviteRewardLevel, the plugin pays inviteRewardChips to them and to the player who invited them, once. It uses the core referral links and their fraud checks (the affiliate programme: the link is the player’s referral link) and the Progression plugin’s level-ups (plugin:progression:level-up); without either, nothing is paid. |
inviteRewardChips | 100,000 | Play chips for each of the two players (1 to 10,000,000). |
inviteRewardLevel | 5 | The level the invited player must reach (2 to 1000). |
The plugin refuses settings that cannot be meant (negative numbers, a maximum below the minimum, more than 500 friends) when you save them.
Real-money gifts
Real-money gifting is built in but off by default, and it stays impossible until you do both of these:
- Turn on
realGiftsEnabledin the plugin’s Settings. - Set a real transfer cap above 0: Extensions › Plugins, View details on the Social row, Wallet daily caps › Transfers (super-admin). The cap is the most real money the plugin may move between players per UTC day, across all players. It starts at 0, and the plugin’s manifest can’t change it.
Every real-money gift then goes through the same core path as a cashier player-to-player transfer: real money must be enabled, both players need at least the minimum KYC tier (TIER_1 by default, set in the transfer settings), the AML check runs on both players, the sender must not be seated at a table, the sender must have no real-money bonus whose wagering is unmet, the cashier transfer limits apply (Money › Payment Providers, Player transfers), and every transfer feeds the chip-flow fraud data (a large one raises a fraud alert). Each refusal is shown to the sender in plain words, for example "Your friend must verify their identity before receiving real-money gifts."
Play-chip gifts need no cap (the virtual transfer cap is unlimited by default) and may be sent while seated; they never touch chips in play at a table.
Notification categories
Players switch these in Settings → Notifications, under Social:
| Category | Channels | Sent when |
|---|---|---|
Friend requests (friend-requests) | In-app, push | Someone sends the player a request (in-app and push); the player’s request is accepted (in-app) |
Table invites (invites) | In-app, push | A friend invites the player to their table |
Gifts (gifts) | In-app, push | A friend sends the player a gift |
A switched-off channel sends nothing for that category; the live toast still shows while the player is online.
Admin
Players › Social overview (/admin/plugins/social/overview) shows the number of friendships, pending requests and players with friends, the players with the most friends, the gifting settings in force, and the last 100 gifts with totals per balance type (the log keeps the newest 500).
In Players › Users, a player’s detail drawer shows under Activity their number of friends (with pending requests), how many players they blocked, and their five latest gifts sent and received.
For developers
Capabilities and hooks
| Capability | Used for |
|---|---|
storage | Pair records, per-player indexes, blocks, settings, gift history and the admin gift log |
users:read | Usernames, avatars and countries; username lookup and prefix search; hands played (gift rule) |
presence | Online status and tables; the user:online / user:offline hooks |
realtime | presence, request, accepted, changed, invite and gift events to players |
notify:in-app, notify:push | Request, accept, invite and gift notifications, sent with a registered category (registry.notify.registerCategories, API 1.3) |
wallet:transfer-virtual, wallet:transfer-real | Gifts (registry.wallet.transfer) |
wallet:credit-virtual (1.1.0) | Free daily gifts and invite rewards (registry.wallet.creditVirtual, idempotency keys dgift:<giftId> and invite:<hash>:inviter / invite:<hash>:invited). Installs that upgrade from 1.0.0 grant it in the plugin’s consent dialog |
Hooks: user:online, user:offline, game:player:seated, game:player:left, tournament:player:eliminated and tournament:finished schedule a presence push; plugin:settings:saved refreshes the settings cache; the plugin:settings:validate filter checks the settings; server:routes:admin mounts the admin routes; auth:user:registered (its referrerId, plugin API 1.4) records who invited the player and plugin:progression:level-up pays the invite reward (1.1.0). register() also registers the three notification categories.
Storage layout
| Scope | Key | Value |
|---|---|---|
| Global | pair:<a>:<b> | { status: 'pending' | 'accepted', requestedBy, createdAt, acceptedAt }, the source of truth for a friendship or request. <a> and <b> are the two user ids, sorted (ids with characters outside [a-z0-9_-] are hashed). |
| Global | giftlog:<time>:<giftId> | The admin’s recent-gifts log, newest 500 kept |
| Player | f:<other> | { userId, status: 'accepted' | 'pending-in' | 'pending-out', since }, the index used for listing |
| Player | block:<other> | { userId, at }: this player blocked <other> |
| Player | settings | The player settings above |
| Player | counts | { friends, pendingIn, pendingOut }, recounted from the index (admin stats) |
| Player | g:<giftId> | A sent or received gift, newest 200 kept |
| Player | ghold:<YYYY-MM-DD>:s:<giftId> / ghold:<YYYY-MM-DD>:r:<hash> | One row per gift sent or received that UTC day; the daily limits and the cooldown are summed from them. Each gift writes its rows before the money moves, so gifts racing on several nodes never go over a limit together (both are refused instead) |
| Player | glast:<other> | The last gift to <other> (cooldown) |
| Player | rl:<name> | Fixed-window rate limits |
| Player | dg:<giftId> | A free daily gift waiting in this player’s inbox: { giftId, fromId, amount, sentAt, expiresAt } (1.1.0) |
| Player | dgs:<YYYY-MM-DD>:<friend> | { friendId, count }: free gifts this player sent that friend that UTC day; older days are removed |
| Player | invite:by, invite:paid | Who invited the player (from auth:user:registered) and when the invite reward was paid |
Free gifts are paid once. A free gift’s id is derived from the UTC day, the two players and its number that day, so a retried or racing send writes the same inbox entry. Collecting credits each gift with the idempotency key dgift:<giftId> and removes it afterwards: two tabs or two nodes collecting together credit every gift once (the second call counts it as 0). A refused credit (the daily cap) stops the collection and keeps the rest of the inbox. The amount and every date are the server’s; the client only names a friend or gifts.
Every change writes the pair first, then both players’ index entries. Listing friends or requests checks each index entry against its pair and repairs a stale or orphaned entry on both sides; reading a pair (a profile view, any friend action) also restores a missing index entry. A per-pair in-process lock serialises the read-modify-write of one pair on a node.
Friendship rules
src/server/friendships.ts is the state machine: request (none → pending; asking back accepts; refused when blocked either way, when the other player accepts no requests, at the friend limit or with 100 pending), accept and decline (the recipient only), cancel (the sender only), remove (either friend), block (removes any pair). It is pure and unit-tested.
Presence fan-out
On each hook above the plugin waits 1.5 s (so seat rows written by the same event are visible), then reads the player’s presence and settings, applies privacy and sends the same PresenceView to every friend who is online. Pushes are coalesced per player: at most one every 2 seconds per node. Treat presence events as the current state; GET /friends always computes it fresh.
HTTP API
Player routes are under /api/v1/plugins/social, all authenticated; writes need the CSRF token. Errors are { success: false, error: { code, message, details? } } with stable codes.
| Route | Purpose |
|---|---|
GET /friends | { friends: FriendView[], onlineCount, maxFriends, myTables }; each friend carries presence with tables and a link (join, watch, view or private) |
GET /requests | { incoming, outgoing } |
POST /requests | { username } or { userId }: send a request, or accept theirs if they asked first. 404 USER_NOT_FOUND, 403 BLOCKED, REQUESTS_DISABLED, FRIEND_LIMIT, TOO_MANY_PENDING; 429 RATE_LIMITED (50 an hour) |
POST /requests/:userId/accept, /decline | Answer an incoming request (404 NO_REQUEST) |
DELETE /requests/:userId | Cancel your request |
DELETE /friends/:userId | Remove a friend (403 NOT_FRIENDS) |
GET /blocks, POST /blocks { userId }, DELETE /blocks/:userId | Blocks |
GET /search?q= | Username prefix search (2-64 characters, 10 results, 30 searches a minute) with each player’s relation; players who blocked you are left out |
GET /profile/:username | ProfileResponse: relation, canRequest, canGift, presence (friends only) |
GET /settings, PUT /settings | { appearOffline?, hideTable?, allowRequests?, allowGifts? } |
POST /invite | { friendId, tableId? }: invite a friend to your current (non-private) table. 409 NOT_SEATED; 429 once a minute per friend, 30 an hour |
POST /gifts | { giftId, friendId, amount, balanceType, message? }. giftId is generated by the client ([a-z0-9-]{8,64}) and makes the call idempotent: the transfer’s key is gift:<senderId>:<giftId>, and a retry returns the same gift with replayed: true |
GET /gifts | { sent, received, today } |
GET /config | The gifting rules for the UI |
GET /daily-gifts | 1.1.0: { enabled, amount, perFriendDailyLimit, inboxMax, expiryDays, resetsAt, sentToday: { [friendId]: n }, inbox: [{ giftId, from, amount, sentAt, expiresAt }] } |
POST /daily-gifts | { friendId }: send today’s free gift. 409 DAILY_GIFTS_DISABLED, DAILY_GIFT_ALREADY_SENT (with details.resetsAt), INBOX_FULL; 403 NOT_FRIENDS, BLOCKED, RECIPIENT_NOT_ACCEPTING; 400 SELF |
POST /daily-gifts/collect | { giftIds? }: collect the named gifts or all of them; { collected, amount, remaining }. 409/502 COLLECT_FAILED when the first credit is refused |
POST /daily-gifts/:giftId/collect | Collect one gift (404 GIFT_NOT_FOUND) |
GET /invite-reward | { enabled, chips, level } |
Admin routes (engine admin router, authenticate + requireAdmin): GET /api/v1/admin/social/stats (the overview) and GET /api/v1/admin/social/users/:userId ({ userId, friends, pendingIn, pendingOut, blocked, giftsSent, giftsReceived }, the five latest gifts each way, for the user drawer).
Gift error codes. Plugin rules: GIFTS_DISABLED, REAL_GIFTS_DISABLED, NOT_FRIENDS, BLOCKED, RECIPIENT_NOT_ACCEPTING, AMOUNT_INVALID, AMOUNT_TOO_SMALL, AMOUNT_TOO_LARGE, ACCOUNT_TOO_NEW, NOT_ENOUGH_HANDS, FRIENDSHIP_TOO_NEW, GIFT_COOLDOWN, DAILY_SEND_LIMIT, DAILY_RECEIVE_LIMIT, GIFT_ID_REUSED. Core transfer refusals, mapped: PLUGIN_TRANSFER_DAILY_CAP → REAL_GIFTS_NOT_CONFIGURED (real cap 0) or GIFT_CAP_REACHED; TRANSFER_DISABLED; TRANSFER_ACCOUNT_RESTRICTED → ACCOUNT_RESTRICTED; TRANSFER_SEATED → LEAVE_TABLES_FIRST; WAGERING_REQUIREMENTS_NOT_MET (the sender’s real-money bonus is not wagered yet; details.remaining); TRANSFER_KYC_REQUIRED → KYC_REQUIRED or RECIPIENT_KYC_REQUIRED; TRANSFER_AML_REVIEW → AML_REVIEW; TRANSFER_LIMIT_EXCEEDED → TRANSFER_LIMIT; INSUFFICIENT_FUNDS; CONFLICT → GIFT_ID_REUSED. See Wallet: Transfers between players.
Client
Realtime (1.1.0): daily-gift ({ giftId, from, amount }, to the recipient), daily-gifts-changed ({}, after a collection) and invite-reward ({ amount, role: 'inviter' | 'invited', other, level }).
src/client/plugin.tsx registers the fills, the admin page /overview (nav.section: 'users'), the realtime listeners and a small React root for the invite toasts. All strings go through engine.i18n.for('social') with src/locales/en.json.
| Slot | Fill | File |
|---|---|---|
layout.main.header.end | Friends button and drawer | components.tsx |
lobby.sidebar | Friends playing now | components.tsx |
table.seat.badge | Friend star, add friend / block menu | components.tsx |
profile.tabs | Friends tab ({ id: 'friends', audience: 'owner' }) | friends-tab.tsx |
settings.sections | Friends & privacy ({ id: 'social-privacy' }) | friends-tab.tsx |
profile.actions, profile.header.badges | Public profile buttons, Playing now badge | player-actions.tsx |
cashier.transfer.recipient | Friend picker | player-actions.tsx |
admin.user-detail.integrations | Friends and gifts in the admin user drawer | admin.tsx |
The manifest declares the redirects of the old pages ("redirects": [{ "from": "/", "to": "/profile?tab=plugin:friends" }, { "from": "/u/:username", "to": "/players/:username" }]), so they work before the bundle loads.