mobile

package
v0.25.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package mobile is the gomobile-bind entry point used by the iOS Swift app and the Android app. It wraps internal/web.Server so the HTTP server runs in-process via a JNI .so — no subprocess, no exec from nativeLibraryDir, no PIE/page-size/SELinux pitfalls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MessageNotifier added in v0.25.9

type MessageNotifier interface {
	OnNewMessages(count int)
}

MessageNotifier is implemented on the native side (Kotlin/Swift). The Go background chat poll loop calls OnNewMessages when it discovers new messages, so the native app can post a system notification while it's backgrounded (the in-app, foreground case is handled by the web UI). The implementation must be cheap and non-blocking — it runs on a Go poll goroutine.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is a running thefeed-client instance bound to 127.0.0.1.

func NewAndroidServer added in v0.20.0

func NewAndroidServer(dataDir string, preferredPort int) (*Server, error)

NewAndroidServer is NewServer for per-ABI APK builds: the update prompt points at the matching ABI asset.

func NewAndroidUniversalServer added in v0.20.0

func NewAndroidUniversalServer(dataDir string, preferredPort int) (*Server, error)

NewAndroidUniversalServer is NewServer for the universal APK build: the update prompt keeps the user on the universal asset.

func NewServer

func NewServer(dataDir string, preferredPort int) (*Server, error)

NewServer starts a server on 127.0.0.1. preferredPort=0 picks a kernel-assigned port; a positive value is tried first and falls back to kernel-assigned on bind failure. dataDir must be a writable app-private directory (e.g. NSDocumentDirectory on iOS).

func (*Server) Port

func (s *Server) Port() int

Port returns the listening port (0 after Stop).

func (*Server) SetMessageNotifier added in v0.25.9

func (s *Server) SetMessageNotifier(n MessageNotifier)

SetMessageNotifier registers (or, with nil, clears) the native new-message notifier. Safe to call after the server is running.

func (*Server) Stop

func (s *Server) Stop()

Stop closes the listener and waits for serve to return.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL