The main innovation behind Internet of Things (IoT) is the fact that numerous devices will be able to communicate with their surroundings and the world in general. This communication ability of devices is expected to transform the existing network infrastructure in a radical way. The massive growth of the number of connected devices with IoT and the diversity of IoT use-cases and services bring significant technical challenges to existing communication network infrastructures, as they need to integrate heterogeneous and networked devices, objects and services with different requirements. In order to overcome these issues and to realize the potential of IoT, we propose a middleware called CHARIOT, which devises a runtime environment integrating heterogeneous resource-constrained devices and sensors communicating with various protocols, and a scalable and dynamic communication layer that abstracts the connected devices and enables their intercommunication. An urban smart factory scenario is used to highlight the future IoT requirements and the need for CHARIOT.