from .WebRequestHandler import WebRequestHandler
from ..oms import Oms

class WebServer():

	def __init__(self, endpoint, oms : Oms):
		"""
		Initializes a new instance of the Mocha User Interface Service.
		`endpoint` is a tuple consisting of (str address, int port)
		"""
		self.__tup = endpoint
		self._oms = oms

	def serve_forever(self):
		from http.server import HTTPServer

		server = HTTPServer(self.__tup, WebRequestHandler)
		server._oms = self._oms
		server.serve_forever()