note description : "simple application execution" date : "$Date$" revision : "$Revision$" class APPLICATION_EXECUTION_WS inherit WSF_WEBSOCKET_EXECUTION redefine initialize_websocket_options end WEB_SOCKET_EVENT_I create make feature -- Basic operations execute local s: STRING dt: HTTP_DATE do -- To send a response we need to setup, the status code and -- the response headers. -- if request.path_info.same_string_general ("/app") then s := websocket_app_html (9090) -- else -- s := "Hello World!" -- create dt.make_now_utc -- s.append (" (UTC time is " + dt.rfc850_string + ").") -- s.append ("
") -- end if attached request.string_item ("exit") as s_exit and then s_exit.is_case_insensitive_equal_general ("now") then (create {EXCEPTIONS}).die (-1) end response.put_header ({HTTP_STATUS_CODE}.ok, <<["Content-Type", "text/html"], ["Content-Length", s.count.out]>>) response.set_status_code ({HTTP_STATUS_CODE}.ok) response.header.put_content_type_text_html response.header.put_content_length (s.count) if attached request.http_connection as l_connection and then l_connection.is_case_insensitive_equal_general ("keep-alive") then response.header.put_header_key_value ("Connection", "keep-alive") end response.put_string (s) end feature -- Websocket execution new_websocket_handler (ws: WEB_SOCKET): WEB_SOCKET_HANDLER do create Result.make (ws, Current) end initialize_websocket_options (ws: WEB_SOCKET) --