import requests
import json


def send_message(port, msg):
    """
    Sends a JSON message to the node and returns its reply.
    """
    return requests.post("http://localhost:{}/".format(port), json.dumps(msg),
                         headers={'content-type': 'application/json'})