Skip to content

Channels

Wei Tang edited this page Jun 17, 2016 · 2 revisions

HTTP2.jl use channels for handling requests and responses.

After creating the connection, you can use two methods take_evt! and put_act! to take events and put actions to the connection. Note that both methods are blocking.

The action types take_act! takes are as follows:

immutable ActPromise
    stream_identifier::UInt32
    promised_stream_identifier::UInt32
    headers::Array{Header, 1}
end

immutable ActSendHeaders
    stream_identifier::UInt32
    headers::Array{Header, 1}
    is_end_stream::Bool
end

immutable ActSendData
    stream_identifier::UInt32
    data::Array{UInt8, 1}
    is_end_stream::Bool
end

You can use them to send push promises, headers and data through the connection. Note that you must send the initial header before sending other headers, push promises and data.

The event types take_evt! takes are similar:

immutable EvtPromise
    stream_identifier::UInt32
    promised_stream_identifier::UInt32
    headers::Array{Header, 1}
end

immutable EvtRecvHeaders
    stream_identifier::UInt32
    headers::Array{Header, 1}
    is_end_stream::Bool
end

immutable EvtRecvData
    stream_identifier::UInt32
    data::Array{UInt8, 1}
    is_end_stream::Bool
end

A message will be sent to the channel and available for taking whenever the library finished processing a corresponding frame.

Clone this wiki locally