Antano » Antano Server API » Service
Antano® will be released very soon. This is an announcement text

Contents

Search

Service

class services.Service(_server, _service_params)

Bases: object

services Each service is a representation of for example UDP or TCP socket. This could be as well REST and WebSocket

Parameters:{[Class]} -- [general object] (object) –

Methods Summary

can_send() Basic info wether service can send back or not
close() Basic close service
get_service(_params[, _server]) Gets a service from service params EXAMPLE: _params[‘active_service’].append({ # tcp service “id”: 2, “antano_server_id”: 1, # needs to be the same as id above “service_type_id”: 2, “port”: 18002, “host”: “0.0.0.0”, “endpoint”: “”, # in case of rest or websocket /my_endpoint put “my_endpoint” “message_format_in_id”: 1, # message_format “message_format_out_id”: 1, # message_format })
on_received_message(message, address, …) On received message will process the message and if there is a repsonse it will send back to the same stream the client has send
send_message(message, address, stream[, …]) Basic send message from service
start(_params[, _internal]) Service start function starts a specific socket service and binds the ports
stop() Basic stop service

Methods Documentation

static can_send()

Basic info wether service can send back or not

Returns:bool – can send back?
close()

Basic close service

static get_service(_params, _server=None)

Gets a service from service params EXAMPLE: _params[‘active_service’].append({

# tcp service “id”: 2, “antano_server_id”: 1, # needs to be the same as id above “service_type_id”: 2, “port”: 18002, “host”: “0.0.0.0”, “endpoint”: “”, # in case of rest or websocket /my_endpoint put “my_endpoint” “message_format_in_id”: 1, # message_format “message_format_out_id”: 1, # message_format

})

Parameters:{Dict<String, Obj>} -- service param (_params) –
Returns:Service obj – a service
on_received_message(message, address, sock_stream)

On received message will process the message and if there is a repsonse it will send back to the same stream the client has send

Parameters:
  • {bytes[]} -- message data (message) –
  • {Tuple (address) –
  • {mixed} -- Socket or SOCK_STREAM (sock) –
Returns:

[bytes[]] – response

send_message(message, address, stream, is_binary=False)

Basic send message from service

Parameters:
  • {bytes[]} -- message data (message) –
  • {Tuple (address) –
  • {mixed} -- Socket or SOCK_STREAM (sock) –
start(_params, _internal=False)

Service start function starts a specific socket service and binds the ports

Parameters:{Dict<String, obj>} -- service params (_params) –
stop()

Basic stop service

Last update: 10/08/2020 3:43 a.m. (CET)