slskmessages module defines all protocol messages used in the Soulseek network.
Message Types
MessageType Constants
Internal application messages
Server protocol messages
Peer protocol messages
File transfer messages
Distributed network messages
Status Constants
UserStatus
User is offline
User is away
User is online
TransferRejectReason
Transfer is queued
User is banned
File is not shared
Queue file limit reached
Server Messages
Login
Authenticate with the Soulseek server.Username for authentication
Password for authentication
Client version number
Whether login succeeded (received from server)
Reason for login failure if unsuccessful
WatchUser
Subscribe to status updates for a user.Username to watch
Whether the user exists
User status (0=offline, 1=away, 2=online)
Average upload speed
Number of shared files
Number of shared directories
FileSearch
Initiate a global file search.Unique search token for tracking results
Search query
JoinRoom
Join a chat room.Name of the room to join
Whether the room is private
List of UserData objects for room members
Room owner (for private rooms)
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.Username sending the results
Search token from the request
List of matching files with metadata
Whether upload slots are available
Average upload speed
Number of files queued for this user
TransferRequest
Request to initiate a file transfer.0 for download, 1 for upload
Unique transfer token
Virtual file path
Size of file in bytes
QueueUpload
Queue a file for upload.Virtual file path to queue
Utility Functions
initial_token()
Random token value
increment_token()
Current token value
Incremented token value
File Attributes
TheFileAttributes class stores audio file metadata.
Audio bitrate in kbps
Duration in seconds
Variable bitrate flag (0 or 1)
Sample rate in Hz
Bit depth for lossless audio
Message Packing/Unpacking
All message classes inherit fromSlskMessage and implement:
make_network_message()- Serializes message to bytesparse_network_message()- Deserializes bytes to message
Messages use little-endian byte order and length-prefixed strings for network transmission.