toolips session extension

The ToolipsSession extension is loaded into apps by default whenever the new_webapp() method is used to create their files, along with the Files extension from the Toolips core (?(Files)).

ToolipsSession.SessionType

Session

  • type::Vector{Symbol}
  • f::Function
  • active_routes::Vector{String}
  • events::Dict{String, Pair{String, Function}}
  • iptable::Dict{String, Dates.DateTime}
  • timeout::Integer Provides session capabilities and full-stack interactivity to a toolips server.

example

exts = [Session()]
st = ServerTemplate(extensions = exts)
server = st.start()

route!(server, "/") do c::Connection
    myp = p("myp", text = "welcome to my site")
    on(c, myp, "click") do cm::ComponentModifier
        if cm[myp][:text] == "welcome to my site"
            set_text!(cm, myp, "unwelcome to my site")
        else
            set_text!(cm, myp, "welcome to my site")
        end
    end
    write!(c, myp)
end

field info


constructors

ToolipsSession.gen_refMethod

Session

gen_ref() -> ::String


Creates a random string of 16 characters. This is used to map connections to specific events by the session.

example

gen_ref()
"jfuR2wgprielweh3"