# Path: vnpy/rpc/common.py
# HEARTBEAT_TOPIC: str = "heartbeat"
# 
# HEARTBEAT_INTERVAL: int = 10


import threading
import traceback
import zmq
from time import time
from typing import Any, Callable, Dict
from .common import HEARTBEAT_TOPIC, HEARTBEAT_INTERVAL
        # Heartbeat related
        self._heartbeat_at: int = None

    def is_active(self) -> bool:
        """"""
        return self._active

    def start(
        self,
        rep_address: str,
        pub_address: str,
    ) -> None:
        """
        Start RpcServer
        """
        if self._active:
            return

        # Bind socket address
        self._socket_rep.bind(rep_address)
        self._socket_pub.bind(pub_address)

        # Start RpcServer status
        self._active = True

        # Start RpcServer thread
        self._thread = threading.Thread(target=self.run)
        self._thread.start()

        # Init heartbeat publish timestamp

# Path: vnpy/rpc/common.py
# HEARTBEAT_TOPIC: str = "heartbeat"
# 
# HEARTBEAT_INTERVAL: int = 10


# Path: vnpy/rpc/server.py
import threading
import traceback
import zmq
from time import time
from typing import Any, Callable, Dict
from .common import HEARTBEAT_TOPIC, HEARTBEAT_INTERVAL

        # Heartbeat related
        self._heartbeat_at: int = None

    def is_active(self) -> bool:
        """"""
        return self._active

    def start(
        self,
        rep_address: str,
        pub_address: str,
    ) -> None:
        """
        Start RpcServer
        """
        if self._active:
            return

        # Bind socket address
        self._socket_rep.bind(rep_address)
        self._socket_pub.bind(pub_address)

        # Start RpcServer status
        self._active = True

        # Start RpcServer thread
        self._thread = threading.Thread(target=self.run)
        self._thread.start()

        # Init heartbeat publish timestamp

        self._heartbeat_at = time() + HEARTBEAT_INTERVAL