The Internet of Things (IoT) is an emerging technology that is growing continuously thanks to the number of devices deployed and data generated. Nevertheless, an upper layer to abstract the limitations of storing, processing, battery and networking is becoming a mandatory need in this field. Cloud Computing is especially suitable technology that can supplement this field in the limitations mentioned. However, the current platforms are not prepared for querying large amounts of data with arbitrary functions in real-time, which are necessary requirements for real-time systems. This paper presents Lambda-CoAP architecture, a novel paradigm not introduced yet to the best of our knowledge, which proposes an integration of Cloud Computing and Internet of Things through the Lambda Architecture (LA) and a Constrained Application Protocol (CoAP) middleware. The Lambda-CoAP architecture has the purpose to query, process and analyze large amounts of IoT data with arbitrary functions in real-time. On the other hand, the CoAP middleware is a lightweight middleware that can be deployed in resource constrained devices and allows the way of the IoT towards the Web of Things. Moreover, the Lambda-CoAP also contains a set of components with well defined interfaces for querying, managing, and actuating over the system.