Giter VIP home page Giter VIP logo

simpleivyconnector's Introduction

SimpleIvyConnector

Simple connector for Ivy API made by the french CENA (Centre d'Etudes de la Navigation Aérienne).

Story

I made this API for a university project where I had to use Ivy with Python. Since there is no clear & simple hello world-like example, I decided to make a simple connector with a basic client-server example (even though it's more like a peer-to-peer system) to help anyone who wanted to start prototyping something with Ivy.

Dependencies

SimpleIvyConnector was developped with Python 3.5 on Windows.

Only needs Ivy ("sudo pip install ivy").

Example

For people who just want to copy and past the file and not look at the example folder :

Server.py

(Technically, this is just the client initiating the Ivy bus)

from SimpleIvyAPI.Connector import Connector
#import logging
#logging.basicConfig(level=logging.DEBUG)

def disconnected(agent):
    print("agent %s disconnected" % agent)

def onConnected(agent):
    list = (1, 1, 9, 5, 13.37, "test")
    
    con.sendMessage(list, keyword="list")
    con.sendMessage("text %s" % list.__str__())
    print("Sent")

con = Connector(clientName="Server", port="2222", onConnected=onConnected, onDisconnected=disconnected )
Client.py
from SimpleIvyAPI.Connector import Connector

def listListener(agent, list):
    print("Got a list !")
    print(list)

def textListener(agent, text):
    print("Got a text !")
    print(text)

def connected(agent):
    print("Connected")

con = Connector(clientName="Client", port="2222", onConnected=connected)
con.addKeywordListener("list", listListener)
con.addRegexListener("text (.*)", textListener)

Licence

Just please respect the GNU GPL licence (file "LICENSE" included at the root folder)

I won't be mad if you don't, but please do ;)

simpleivyconnector's People

Contributors

seblor avatar

Watchers

James Cloos avatar  avatar  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.