Giter VIP home page Giter VIP logo

aioice's Introduction

aioice

rtd pypi-v pypi-pyversions pypi-l pypi-wheel tests codecov

What is aioice?

aioice is a library for Interactive Connectivity Establishment (RFC 5245) in Python. It is built on top of asyncio, Python's standard asynchronous I/O framework.

Interactive Connectivity Establishment (ICE) is useful for applications that establish peer-to-peer UDP data streams, as it facilitates NAT traversal. Typical usecases include SIP and WebRTC.

To learn more about aioice please read the documentation.

Example

#!/usr/bin/env python

import asyncio
import aioice

async def connect_using_ice():
    connection = aioice.Connection(ice_controlling=True)

    # gather local candidates
    await connection.gather_candidates()

    # send your information to the remote party using your signaling method
    send_local_info(
        connection.local_candidates,
        connection.local_username,
        connection.local_password)

    # receive remote information using your signaling method
    remote_candidates, remote_username, remote_password = get_remote_info()

    # perform ICE handshake
    for candidate in remote_candidates:
        await connection.add_remote_candidate(candidate)
    await connection.add_remote_candidate(None)
    connection.remote_username = remote_username
    connection.remote_password = remote_password
    await connection.connect()

    # send and receive data
    await connection.sendto(b'1234', 1)
    data, component = await connection.recvfrom()

    # close connection
    await connection.close()

asyncio.get_event_loop().run_until_complete(connect_using_ice())

License

aioice is released under the BSD license.

aioice's People

Contributors

jlaine avatar frankkkkk avatar marksteward avatar khancyr avatar saiongole avatar xobs avatar sebastianriese avatar buendiya avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.