
chat.pl -- The SWISH collaboration backboneWe have three levels of identity as enumerated below. Note that these form a hierarchy: a particular user may be logged on using multiple browsers which in turn may have multiple SWISH windows opened.
start_chat(+Request)[private]
check_flooding(+Session)[private]
accept_chat(+Session, +Options, +WebSocket)[private]
wsid_status(?WSID, ?Status)[private]
wsid_session(?WSID, ?SessionId)[private]
session_user(?Session, ?TmpUser)[private]
visitor_data(?TmpUser, ?UserData:dict)[private]
subscription(?WSID, ?Channel, ?SubChannel)[private]wsid_status(+WSID, -Status)
retract(wsid_status(+WSID, -Status))assertz(wsid_status(+WSID, +Status))retractall(wsid_status(+WSID, _))gitty
redis_key(+Which, -Server, -Key) is semidet[private]
redis_key_ro(+Which, -Server, -Key) is semidet[private]
wsid_status(+WSID, -Status)[private]lost(Time) if we lost contact at Time or unload
if the websocket was cleanly disconnected.
The Redis version keeps two keys per WSID as described below. Note that these keys only exist on temporary lost or disconnecting websockets.
wsid_status_del_unload(+WSID) is semidet[private]unload and this status is removed.
register_wsid_session(+WSID, +Session) is det[private]Redis data:
at(Consumer,Session)
wsid_session(?WSID, ?Session) is nondet[private]
wsid_session(?WSID, ?Session, -Consumer) is nondet[private]
wsid_session_reclaim(+WSID, -Session) is semidet[private]
wsid_session_reclaim_all(+WSID, +Session) is det[private]
current_wsid(?WSID) is nondet[private]
session_user(?Session, ?TmpUser:atom)[private]
visitor_data(?Visitor, ?Data)[private]
subscription(?WSID, ?Channel, ?SubChannel)[private]
channel:SubChannel --> set(WSID-Channel)
subscription:WSID --> set(Channel-SubChannel)
subscribe(+WSID, +Channel) is det[private]
subscribe(+WSID, +Channel, +SubChannel) is det[private]
unsubscribe(?WSID, ?Channel) is det[private]
unsubscribe(?WSID, ?Channel, ?SubChannel) is det[private]
visitor(?WSID) is nondet[private]
visitor(?WSID, -Consumer) is nondet[private]
pending_visitor(+WSID, +Timeout) is semidet[private]
wsid_visitor(?WSID, ?Visitor)[private]
existing_visitor(+WSID, +Session, -TmpUser, -UserData) is semidet[private]
create_visitor(+WSID, +Session, -TmpUser, -UserData, +Options)[private]icons/avatar.svg#NNN`, which NNN is a
bitmask on the SVG to change its appearance,
random_key(+Len, -Key) is det[private]
destroy_visitor(+WSID) is det[private]
update_session_timeout(+WSID) is det[private]
gc_visitors[private]session_lost_timeout
seconds.
This also updates active_wsid/2 to reflect the current status.
reclaim_visitor(+WSID) is det[private]
create_session_user(+Session, -User, -UserData, +Options)[private]
update_visitor_data(+TmpUser, +Data, +Reason) is det[private]
update_avatar_from_email(+Email, +DataIn, -Data)[private]
anonymise_user_data(TmpUser, Data)[private]
set_visitor_data(+TmpUser, +Data, +Reason) is det[private]
inform_visitor_change(+TmpUser, +Reason) is det[private]
sync_gazers(+WSID, +Files:list(atom)) is det[private]
add_user_details(+Message, -Enriched) is det[private]uid field.
public_user_data(+UID, -Public:dict) is det[private]
get_visitor_data(-Data:dict, +Options) is det[private]
Data always contains an avatar key and optionally contains a
name and email key. If the avatar is generated there is also
a key avatar_generated with the value true.
reply_avatar(+Request)[private]Not really. A new user gets a new avatar and this is based on whether or not the file exists. Probably we should maintain a db of handed out avatars and their last-use time stamp. How to do that? Current swish stats: 400K avatars, 3.2Gb data.
chat_broadcast(+Message) is det
chat_broadcast(+Message, +Channel) is detswish:chat pubsub channel and listening for
swish:chat calls chat_broadcast_local/1,2 in each instance.
subscribed(+Channel, +WSID) is semidet[private]
subscribed(+Channel, +SubChannel, +WSID) is semidet[private]
send_friends(+WSID, +Message)[private]
update_visitors(+Msg) is det[private]
handle_message(+Message, +Room)[private]
json_message(+Message, +WSID) is det[private]
forbidden(+Message, +DocID, -Why) is semidet[private]
block(+User, +Score, -Cummulative, -Count)[private]
chat_add_user_id(+WSID, +Message0, -Message) is det[private]
chat_about(+DocID, +Message) is det
chat_relay(+Message) is det[private]
chat_enrich(+Message0, -Message) is det[private]
chat_send(+Message)[private]volatile
property it is broadcasted, but not stored.
chat_event(+Event) is semidet[private]http.
propagate_profile_change(+ProfileID, +Attribute, +Value)[private]
broadcast_event(+Event) is semidet[private]
broadcast_event(+Event, +File, +WSID) is det[private]
event_html(+Event, -HTML:string) is det[private]
event_file(+Event, -File) is semidet[private]
chat_to_profile(ProfileID, :HTML) is det
notifications(+Options)//
broadcast_bell(+Options)//