Skip to Content
HomeLink Hub
Agent & Landlord Experience

Chats and notifications

How agents, landlords and lawyers read and answer messages, what the Notifications screen really shows, and how push notifications are registered and routed.

Chat is real time and runs almost entirely over a Socket.IO connection. The Notifications screen is a different thing: it is a view over the dashboard activity feed, with read state kept on the device. Push notifications are registered once per signed-in account and decide where a tap lands.

Where it lives

Screen routeFileWho sees it
/(tabs)/chatsapp/(tabs)/chats/index.tsxAgents, landlords and lawyers (Chats tab, second icon in the tab bar)
/(tabs)/chats/[id]app/(tabs)/chats/[id].tsxSame roles, opened from a row in the list or from a push notification
/(tabs)/notificationsapp/(tabs)/notifications.tsxSame roles. Hidden from the tab bar (href: null), opened from the bell on the dashboard home or from a push notification
(no screen)hooks/use-push-notifications.ts, lib/push-notifications.tsEvery signed-in user. Mounted once in app/_layout.tsx as PushNotificationsRegistrar

Supporting code: hooks/use-chat.ts (socket lifecycle and events), services/chat/socket.service.ts (the single socket instance), services/chat/chat-slice.ts (Redux chat slice), services/chat/chat-api.ts (REST endpoints under /api/v1/chat), components/ChatListItem.tsx, components/ChatHeader.tsx.

Before you start

  • The user must be signed in. The socket authenticates with the access token read from AsyncStorage key session:ACCESS_TOKEN at the moment the socket is created.
  • An agent must have finished agent setup, otherwise the (tabs) layout redirects to /agent-onboarding before any of these screens render.
  • Push notifications need a physical device, the OS notification permission, and a build that carries an EAS project id. On a simulator the app logs [push] skipped: push tokens need a physical device and carries on without push.
  • No camera, photo or microphone permission is requested by these screens. The attachment and microphone buttons in the composer are not wired up (see States and edge cases).

Flow

Chat list

  1. The user taps the Chats tab. The screen title is Messages.
  2. useChat(null) connects the socket to the API host (not the /api/v1 path) with auth: { token }, reconnection on, 5 attempts, 2000 ms apart.
  3. On connect the app sets chat.connected to true and emits chat:get_rooms. The server answers with chat:rooms, an array of rooms, which is stored in chat.rooms.
  4. Under the search box a status line reads Connected to chat server or Connecting to chat....
  5. Each room becomes one row:
    • Name: room.name, else the first participant's first and last name, else Chat room.
    • Preview: room.lastMessage, else Start a new conversation.
    • Time: hours and minutes of lastMessageAt (falling back to createdAt). No date is shown, even for old conversations.
    • Avatar: the first participant's avatar, else a generated placeholder image.
  6. Typing in Search by name... filters rows locally by name (case-insensitive substring). An X button clears the query. Nothing is sent to the server.
  7. While the list is open, chat:room_updated events (roomId, lastMessage, lastMessageAt) update the preview and time of the matching row in place.
  8. Tapping a row pushes /chats/[id] with the room id.

List indicators that are not real yet

The green dot on an avatar is driven by whether the participant has an avatar image, not by presence. The unread badge is always hidden because unreadCount is hardcoded to 0. The filter icon in the search box has no handler.

Chat thread

  1. On mount the screen reads the signed-in user's id from AsyncStorage key local:USER (_id, falling back to id). Until that resolves the id is the placeholder "1", so for a moment every bubble is drawn as the other party's.
  2. useChat(roomId) emits chat:join with { roomId }. The server replies with chat:history (roomId plus messages), which is merged into chat.socketMessages[roomId], de-duplicated by _id and sorted oldest first.
  3. The header shows the room name (or Chat), the avatar of the first participant, and a status of Online when the socket is connected or Connecting when it is not. A verified tick is always drawn next to the name.
  4. The user types in Type a message.... The send button is disabled until the trimmed text is non-empty.
  5. Tapping send emits chat:message with { roomId, content, messageType: "TEXT" } and clears the input. There is no optimistic bubble: the message appears when the server broadcasts chat:message back to the room.
  6. Incoming chat:message events are appended to chat.socketMessages[roomId] unless a message with the same _id is already there.
  7. The user's own bubbles sit on the right with a double tick; the tick is decorative and does not reflect readBy. Each bubble shows the time as hours and minutes.
  8. Leaving the screen emits chat:leave with { roomId }.

Only plain text can be sent. The MessageType type lists IMAGE, FILE and AUDIO, but nothing in the screen produces them.

Composer menu

The menu (three lines) button inside the composer opens a bottom sheet with three shortcuts:

LabelNavigates to
Schedule Inspection/property/inspection
Make Payment/property/payment
Request Documents/property/contract

Menu shortcuts look tenant-oriented

All three routes are tenant-side flows and are pushed without a property id or any other parameter. For an agent, landlord or lawyer they are unlikely to be meaningful. Treat this menu as unfinished on the professional side.

Report a chat

  1. The red flag in the header opens the Report Chat sheet with the prompt Why are you reporting this chat?
  2. The user picks one reason: Spam (preselected), Harassment, Fraud, Inappropriate Content or Other. There is no free-text field.
  3. Submit fires POST /api/v1/chat/rooms/:roomId/report with body { reason }.
  4. Success closes the sheet and shows the toast Chat Reported / Your report has been submitted for review.
  5. Failure keeps the sheet open and shows Report Failed / Could not submit your report at this time.
  6. Cancel or tapping outside closes the sheet without sending anything.

How a conversation starts

No screen in the (tabs) navigator creates a room. Rooms arrive only through chat:rooms, so an agent or landlord sees a conversation once the other party has opened it. The hook exposes createAndSend(propertyId, content), which emits chat:create_and_send, and chat-api.ts defines POST /api/v1/chat/rooms, but neither is called from any screen in this part of the app.

Notifications screen

  1. The user taps the bell on the dashboard home (router.push("/notifications")), or taps a push notification that is not a chat event.
  2. The screen calls GET /api/v1/dashboard/recent-activity. There is no dedicated notifications endpoint behind this screen.
  3. Each activity item is mapped to a card:
Activity typeCategory chipTitleBody
bookingPaymentsPayment Request Update<actor> requested payment for <property>.
messageMessages<actor> sent a messageThe message text, else the property name, else You have a new message.
inspectionPropertyInspection Activity<actor> updated <property>.
reviewPropertyProperty Review Activity<actor> updated <property>.
anything elseSecuritySecurity AlertThe item text, else A security-related update was received.
  1. Cards are sorted newest first and show a relative time such as 5 mins ago, 2 hrs ago or 3 days ago.
  2. The chips All, Property, Messages, Payments and Security filter the list locally.
  3. Tapping a card marks it read: the unread dot disappears and the card dims. Read state is a map of card id to true in AsyncStorage key notifications_read_map_v1. It is device-local and never sent to the server.
  4. Clear all marks every loaded card as read. It does not remove cards.
  5. Refresh at the bottom refetches the activity feed.

Cards do not deep link

Tapping a card only marks it read. It does not open the related chat, inspection request or payment request. The subtitle Real-time in-app notifications is aspirational: the list updates only on load and on Refresh.

Push notification registration

  1. PushNotificationsRegistrar runs for every signed-in user once the session has been restored. It re-runs when the signed-in account changes.
  2. On Android the app creates the default channel (name Notifications, high importance) before asking for permission.
  3. If permission is undecided the OS prompt is shown. A refusal ends the flow silently.
  4. The app requests an Expo push token and posts it with platform (ios or android) and deviceName. The token is then cached in AsyncStorage key local:PUSH_TOKEN.
  5. If Expo rotates the token, the listener registers the new one the same way.
  6. While the app is in the foreground, pushes still show a banner and play a sound; the badge count is not set.
  7. On sign out the app sends a delete request for the cached token before the session is cleared, then removes local:PUSH_TOKEN. A failure here never blocks sign out.

Push token path does not match the backend mount

The app posts to and deletes from /api/v1/users/push-tokens (plural). In the service, the handler is registered on the user router, which is mounted at /api/v1/user (singular), so the route the backend serves is POST /api/v1/user/push-tokens and DELETE /api/v1/user/push-tokens. No /users mount exists in service/src/routes/index.ts. Registration errors are swallowed, so this would fail silently. Confirm on a device before relying on push.

Tapping a push notification

  1. Taps are ignored until the session is restored, a user is present, and the current route is outside (onboarding), (auth) and agent-onboarding. A tap that cold-starts the app is replayed once those conditions hold.
  2. The push data carries eventType and meta.
  3. If eventType is new_chat_request or new_message and meta.roomId is set, the app pushes /(tabs)/chats/<roomId>.
  4. Every other event opens /(tabs)/notifications.
  5. The handled response is cleared so the next launch does not replay it.

States and edge cases

  • Chat list empty states. Connected with no rooms: No Conversations Yet / Start a chat from any property and it will show up here. Not connected: Connecting… / Waiting for the chat connection. This usually takes a moment. Search with no match: No Conversations Found / Nothing matched "<query>". Try a different name.
  • No loading skeleton in either chat screen. The list shows the connecting empty state; the thread is simply empty until chat:history arrives.
  • Send failures are silent. The server emits chat:error when a join or send fails, but the app does not listen for it. Nothing tells the user a message was not delivered.
  • Dead buttons. In the thread header the phone and video icons have no handler. In the composer the paperclip and microphone have no handler.
  • Typing indicators are not shown. The hook listens for chat:typing and can emit it, but the thread screen neither calls sendTyping nor renders typingUsers.
  • Unused REST endpoints. GET /api/v1/chat/rooms, GET /api/v1/chat/rooms/:roomId/messages, POST /api/v1/chat/rooms/:roomId/messages and DELETE /api/v1/chat/messages/:messageId are defined in chat-api.ts but not called by these screens. There is no delete-message or edit-message UI.
  • Reconnects. After 5 failed reconnection attempts the socket gives up; the status stays on Connecting to chat... until the screen is remounted. The token is read once when the socket is created, so a socket opened with an expired access token is not rebuilt automatically.
  • Notifications loading and empty. While loading or refetching: a spinner with Loading notifications.... No items in the selected category: No Notifications Yet / Updates about your properties, requests and payments will appear here.
  • Security chip is effectively empty. The activity feed only declares the types message, inspection, booking and review, so nothing normally falls through to the Security category.
  • Notification ids are derived, built from type, time and actor. Two activities by the same actor at the same instant would share a read state.
  • Sign out. The whole Redux store, including the chat slice, is reset on logout or session expiry, so rooms and messages from one account never leak into the next.

Returning from a thread may leave the list disconnected

Both the list and the thread mount useChat, and each instance calls disconnectSocket() when it unmounts. Closing a thread therefore disconnects the socket the list is still listening on, and a manual disconnect does not auto-reconnect. Reading the code, the list would then show Connecting to chat... and stop receiving chat:room_updated until it remounts. Verify on a device.

What happens next

  • A sent message is broadcast by the server to everyone in the room as chat:message, and each participant receives chat:room_updated so their chat list preview changes.
  • A submitted report is stored by the backend for review. The app shows no follow-up state for it.
  • Which pushes a user receives is governed by their notification preferences. See the Profile and settings page for the Push and Email switches.

On this page