moq_session_connect

Function moq_session_connect 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn moq_session_connect( url: *const c_char, url_len: usize, origin_publish: u32, origin_consume: u32, on_status: Option<extern "C" fn(user_data: *mut c_void, code: i32)>, user_data: *mut c_void, ) -> i32
Expand description

Start establishing a connection to a MoQ server.

Takes origin handles, which are used for publishing and consuming broadcasts respectively.

  • Any broadcasts in origin_publish will be announced to the server.
  • Any broadcasts announced by the server will be available in origin_consume.
  • If an origin handle is 0, that functionality is completely disabled.

This may be called multiple times to connect to different servers. Origins can be shared across sessions, useful for fanout or relaying.

Returns a non-zero handle to the session on success, or a negative code on (immediate) failure. You should call moq_session_close, even on error, to free up resources.

The callback is called on success (status 0) and later when closed (status non-zero).

ยงSafety

  • The caller must ensure that url is a valid pointer to url_len bytes of data.
  • The caller must ensure that on_status is valid until moq_session_close is called.