Skip to main content
The C interface reports results through return values. Functions that return int all use the five values below: RTC_OK is 0, and every failure is negative.

Values

RTC_ERROR is a catch-all failure code. Get the specific reason with rtc_get_last_error (since 0.0.9); it returns the 180xxx / 1xxx error codes described in the next two sections. You can also raise the log level to see the reason:
The logs then print a more specific error, such as 180001: 您不在频道内 (“you are not in the channel”) or 1021: .... The difference between these two kinds of codes is explained in the next two sections.

180xxx in logs: SDK errors

The five C return values only describe the result “at the call level” and carry no reason. The reason is printed in the logs, where 6-digit codes starting with 180 are errors produced by the SDK itself (180 is the prefix for server-side / embedded integrations, and the last three digits identify the specific error):
When you see 180002 (token expired), first make sure the token isn’t being reused: every process needs its own issued token. This and the server’s 1032 below are two symptoms of the same kind of problem.

1xxx and similar in logs: server business error codes

Four-digit codes (≥1000) come from the server. They are business-level reasons for rejection, passed through unchanged by the SDK, for example: For the full list, see Server API · Error codes.
A token is bound to one session, and the session is no longer valid once the process leaves the channel. Reusing the same token to start a second process gets 1032 (RTC_ERROR on the C side)—issue a separate token for every process.

Checking return values

Check the return value of every function that returns int. When a critical path such as joining the channel fails, you must run the cleanup flow to avoid leaking handles:
rtc_create / rtc_create_local_track return pointers, which are NULL on failure; just check for NULL.