0.0.2 • Published 3 years ago

alell-stream-middleware v0.0.2

Weekly downloads
2
License
ISC
Repository
-
Last release
3 years ago

alell-edi-stream

Servidor de mensagens

Prerequisitos

Dialogs Socket dialogs

Global Server Namespace

/users
    server(/users).on(save-config, config)
    server(/users).emit(saved-config)
    server(/users).emit(personal-namespace, '/users/{username}')

User Server Namespace (client01 => client02)

/users/{source}
    client(/users/{source}).emit(join, {destination})
    server(/users/{source}).on(join, generateJoinNamespace({destination}, {visitorUsername}))
        server(/users/{source}).emit(joined-namespace, '/users/{destination}/visitor-{source}')
        server(/users/{destination}).emit(joined-namespace, '/users/{destination}/visitor-{source}')

Joined User / Partner Namespace

/users/{destination}/visitor-{source}
    
    /// ALLOCATION DIALOG
    source(/users/{destination}/visitor-{source}).emit(allocate-stream, Requested)
    server(/users/{destination}/visitor-{source}).on(allocate-stream, Requested)
        server(/users/{destination}).emit(allocate-stream, Requested)

    destination(/users/{destination}).on(allocate-stream, Restested)
        destination(/users/{destination}).emit(allocated-stream, StreamId)

    server(/users/{destination}).on(allocated-stream, StreamId)
        server(/users/{destination}/visitor-{source}).emit(allocated-stream, StreamId)
    source(/users/{destination}/visitor-{source}).on(allocated-stream, StreamId)

    /// STATS DIALOG
    source(/users/{destination}/visitor-{source}).emit(get-stats-of-stream-id, StreamId)
    server(/users/{destination}/visitor-{source}).on(get-stats-of-stream-id, StreamId)
        server(/users/{destination}).emit(get-stats-of-stream-id, StreamId)

    destination(/users/{destination}).on(get-stats-of-stream-id, StreamId)
        destination(/users/{destination}).emit(stats-of-stream-id, Stats)

    server(/users/{destination}).on(stats-of-stream-id, Stats)
        server(/users/{destination}/visitor-{source}).emit(stats-of-stream-id, Stats)
    source(/users/{destination}/visitor-{source}).on(stats-of-stream-id, Stats)

    /// STREAM DIALOG
    source(/users/{destination}/visitor-{source}).emit(streaming, StreamId, stream)
    server(/users/{destination}/visitor-{source}).on(streaming, StreamId, stream)
        server(/users/{destination}).emit(streaming, StreamId, stream)

    destination(/users/{destination}).on(streaming, StreamId, stream)
        destination(/users/{destination}).emit(stream-end, StreamId)

    server(/users/{destination}).on(stream-end, StreamId)
        server(/users/{destination}/visitor-{source}).emit(stream-end, StreamId)
    source(/users/{destination}/visitor-{source}).on(stream-end, StreamId)