Skip to main content
The slskmessages module defines all protocol messages used in the Soulseek network.

Message Types

MessageType Constants

str
Internal application messages
str
Server protocol messages
str
Peer protocol messages
str
File transfer messages
str
Distributed network messages

Status Constants

UserStatus

int
User is offline
int
User is away
int
User is online

TransferRejectReason

str
Transfer is queued
str
User is banned
str
File is not shared
str
Queue file limit reached

Server Messages

Login

Authenticate with the Soulseek server.
str
Username for authentication
str
Password for authentication
int
Client version number
bool
Whether login succeeded (received from server)
str
Reason for login failure if unsuccessful

WatchUser

Subscribe to status updates for a user.
str
Username to watch
bool
Whether the user exists
int
User status (0=offline, 1=away, 2=online)
int
Average upload speed
int
Number of shared files
int
Number of shared directories

FileSearch

Initiate a global file search.
int
Unique search token for tracking results
str
Search query

JoinRoom

Join a chat room.
str
Name of the room to join
bool
Whether the room is private
list
List of UserData objects for room members
str
Room owner (for private rooms)
list
List of room operators (for private rooms)

Peer Messages

SharedFileListRequest

Request a peer’s shared file list.

FileSearchResponse

Respond to a search request with matching files.
str
Username sending the results
int
Search token from the request
list
List of matching files with metadata
bool
Whether upload slots are available
int
Average upload speed
int
Number of files queued for this user

TransferRequest

Request to initiate a file transfer.
int
0 for download, 1 for upload
int
Unique transfer token
str
Virtual file path
int
Size of file in bytes

QueueUpload

Queue a file for upload.
str
Virtual file path to queue

Utility Functions

initial_token()

Generates a random initial token for searches and transfers.
int
Random token value

increment_token()

Increments a token, wrapping at UINT32 limit.
int
Current token value
int
Incremented token value

File Attributes

The FileAttributes class stores audio file metadata.
int
Audio bitrate in kbps
int
Duration in seconds
int
Variable bitrate flag (0 or 1)
int
Sample rate in Hz
int
Bit depth for lossless audio

Message Packing/Unpacking

All message classes inherit from SlskMessage and implement:
  • make_network_message() - Serializes message to bytes
  • parse_network_message() - Deserializes bytes to message
Messages use little-endian byte order and length-prefixed strings for network transmission.